{"id":32818,"date":"2025-05-07T10:07:35","date_gmt":"2025-05-07T08:07:35","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/?p=32818"},"modified":"2025-05-07T10:07:38","modified_gmt":"2025-05-07T08:07:38","slug":"evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/","title":{"rendered":"Evitare la duplicazione del codice sfruttando le high-order function in JavaScript"},"content":{"rendered":"\n<p>Il linguaggio JavaScript \u00e8 sempre pi\u00f9 utilizzato anche lato server grazie alle numerose librerie di sviluppo disponibili. Ci\u00f2 comporta un considerevole aumento della complessit\u00e0 del codice che deve essere sempre pi\u00f9 aperto alle estensioni e chiuso verso le modifiche. <\/p>\n\n\n\n<p>Nel seguito dell&#8217;articolo verr\u00e0 mostrato come evitare la duplicazione del codice sfruttando le high-order function in JavaScript.<\/p>\n\n\n\t\t\t\t<div class=\"wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-b8eeed88      \"\n\t\t\t\t\tdata-scroll= \"1\"\n\t\t\t\t\tdata-offset= \"30\"\n\t\t\t\t\tstyle=\"\"\n\t\t\t\t>\n\t\t\t\t<div class=\"uagb-toc__wrap\">\n\t\t\t\t\t\t<div class=\"uagb-toc__title\">\n\t\t\t\t\t\t\tIndice\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"uagb-toc__list-wrap \">\n\t\t\t\t\t\t<ol class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#problemi-di-duplicazione-del-codice\" class=\"uagb-toc-link__trigger\">Problemi di duplicazione del codice<\/a><li class=\"uagb-toc__list\"><a href=\"#first-class-object-e-high-order-function\" class=\"uagb-toc-link__trigger\">First class object e high-order function<\/a><li class=\"uagb-toc__list\"><a href=\"#comparatori-e-algoritmi-di-ordinamento\" class=\"uagb-toc-link__trigger\">Comparatori e algoritmi di ordinamento<\/a><\/ol>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\n\n<h2 class=\"wp-block-heading\" id=\"h-problemi-di-duplicazione-del-codice\">Problemi di duplicazione del codice<\/h2>\n\n\n\n<p>Innanzitutto illustriamo in modo chiaro un problema tipico: viene fornito un un array di oggetti <a href=\"https:\/\/www.codemotion.com\/magazine\/it\/frontend-it\/javascript-it\/come-programmare-con-javascript-tutto-sul-linguaggio-per-il-web\/\">JavaScript <\/a>che rappresentano utenti di una web app e che possiedono gli attributi nome, cognome, e post. Post \u00e8 una lista di stringhe contenente il titolo di ciascun post pubblicato.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">let<\/span> p = {\n    <span class=\"hljs-string\">\"name\"<\/span>: <span class=\"hljs-string\">\"Mary\"<\/span>,\n    <span class=\"hljs-string\">\"surname\"<\/span>: <span class=\"hljs-string\">\"Smith\"<\/span>,\n    <span class=\"hljs-string\">\"posts\"<\/span>: &#91;<span class=\"hljs-string\">\"image.png\"<\/span>, <span class=\"hljs-string\">\"codemotionRome.png\"<\/span>, <span class=\"hljs-string\">\"article.txt\"<\/span>]\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Si vogliono implementare diversi algoritmi di ordinamento dell&#8217;array come ad esempio <em><a href=\"https:\/\/it.wikipedia.org\/wiki\/Selection_sort\" target=\"_blank\" rel=\"noreferrer noopener\">selectionSort <\/a><\/em>e <em><a href=\"https:\/\/it.wikipedia.org\/wiki\/Bubble_sort\" target=\"_blank\" rel=\"noreferrer noopener\">bubbleSort<\/a><\/em>. Si vuole anche implementare la possibilit\u00e0 di ordinare l&#8217;array per nome, per cognome oppure per numero di post pubblicati.<\/p>\n\n\n\n<p>Per implementare un algoritmo di ordinamento \u00e8 necessario confrontare l&#8217;attributo di interesse secondo il quale si vuole ordinare. Tuttavia, il confronto fra due nomi avviene in maniera differente rispetto al confronto fra numeri di post pubblicati:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">let<\/span> people = &#91;p0, p1, p2, ...]\n\n<span class=\"hljs-comment\">\/\/ Confronto persone per nome<\/span>\npeople&#91;<span class=\"hljs-number\">0<\/span>]&#91;<span class=\"hljs-string\">\"name\"<\/span>] &gt; people&#91;<span class=\"hljs-number\">1<\/span>]&#91;<span class=\"hljs-string\">\"name\"<\/span>]\n\n<span class=\"hljs-comment\">\/\/ Confronto persone per post pubblicati<\/span>\npeople&#91;<span class=\"hljs-number\">0<\/span>]&#91;<span class=\"hljs-string\">\"posts\"<\/span>].length &gt; people&#91;<span class=\"hljs-number\">1<\/span>]&#91;<span class=\"hljs-string\">\"posts\"<\/span>].length<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Si potrebbe quindi pensare di sviluppare le seguenti funzioni, modificando solamente l&#8217;implementazione del confronto fra oggetti:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">selectionSortByName(){...};\nbubbleSortByName(){...};\nselectionSortByPosts(){...};\nbubbleSortByPosts(){...};\n...<\/code><\/span><\/pre>\n\n\n<p>La soluzione sopra proposta risulta essere veramente pessima poich\u00e9 comporta un&#8217;ampia duplicazione del codice che esegue gli algoritmi di <em>selectionSort <\/em>e <em>bubbleSort <\/em>causando i seguenti problemi:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Diventa necessario definire molte funzioni con implementazione quasi identica<\/li>\n\n\n\n<li>Se si verifica un errore nell&#8217;algoritmo di una funzione, tutte le altre funzioni della stessa famiglia devono essere modificate manualmente per risolvere lo stesso problema<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-first-class-object-e-high-order-function\">First class object e high-order function<\/h2>\n\n\n\n<p>In JavaScript le funzioni sono oggetti di prima classe (<em>first-class object<\/em>), ci\u00f2 significa che il loro codice (signature e implementazione) pu\u00f2 essere assegnato a una variabile.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">foo<\/span>(<span class=\"hljs-params\"><\/span>)<\/span>{\n    <span class=\"hljs-built_in\">console<\/span>.log(<span class=\"hljs-string\">\"Executing foo...\"<\/span>);\n}\n\n<span class=\"hljs-built_in\">console<\/span>.log(foo)    <span class=\"hljs-comment\">\/\/Stampa il codice della funzione<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Un funzione si dice di ordine superiore (<em>high-order function<\/em>) quando accetta come argomento un&#8217;altra funzione, oppure quando ritorna una funzione come risultato.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">foo = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>(<span class=\"hljs-params\"><\/span>)<\/span>{\n   <span class=\"hljs-built_in\">console<\/span>.log(<span class=\"hljs-string\">\"foo\"<\/span>)\n}\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">execute<\/span>(<span class=\"hljs-params\">fn<\/span>)<\/span>{\n    fn()\n}\n\nexecute(foo)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Nel codice sopra proposto la funzione execute() \u00e8 una high-order function.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-comparatori-e-algoritmi-di-ordinamento\">Comparatori e algoritmi di ordinamento<\/h2>\n\n\n\n<p>Si pu\u00f2 quindi pensare di sfruttare la logica delle high-order function per evitare la duplicazione di codice nell&#8217;esempio precedentemente riportato o in casi analoghi. Ecco come procedere:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Definire le high-order function ossia le funzioni che implementano l&#8217;algoritmo di ordinamento e che accettano come parametri l&#8217;array da ordinare e una funzione che sar\u00e0 invocata per eseguire il confronto fra i diversi elementi dell&#8217;array.<\/li>\n\n\n\n<li>Definire diverse funzioni per comparare due oggetti dell&#8217;array, nel nostro caso due persone, secondo parametri differenti. Queste funzioni <em>comparator <\/em>saranno passate come parametro alle high-order function.<\/li>\n<\/ol>\n\n\n\n<p>Un aspetto fondamentale da non tralasciare \u00e8 che le funzioni <em>comparator <\/em>dovranno agire in modo differente, ma avere stessa signature e stessa logica dei valori di ritorno.<\/p>\n\n\n\n<p>Ogni funzione <em>comparator <\/em>accetta due elementi dell&#8217;array e ritorna i seguenti valori:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>-1 se il primo elemento \u00e8 precedente al secondo<\/li>\n\n\n\n<li>0 se i due elementi sono intercambiabili<\/li>\n\n\n\n<li>+1 se il primo elemento \u00e8 successivo al secondo<\/li>\n<\/ul>\n\n\n\n<p>Vediamo un esempio:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">let<\/span> compareByName = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>(<span class=\"hljs-params\">personA, personB<\/span>)<\/span>{\n    <span class=\"hljs-keyword\">if<\/span>(personA.name &lt; personB.name){ <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-number\">-1<\/span>}\n    <span class=\"hljs-keyword\">else<\/span> <span class=\"hljs-keyword\">if<\/span>(personA.name &gt; personB.name){ <span class=\"hljs-keyword\">return<\/span> +<span class=\"hljs-number\">1<\/span> }\n    <span class=\"hljs-keyword\">else<\/span> { <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-number\">0<\/span> }\n}\n\n<span class=\"hljs-keyword\">let<\/span> p1 = {<span class=\"hljs-string\">\"name\"<\/span>: <span class=\"hljs-string\">\"John\"<\/span>, <span class=\"hljs-string\">\"Surname\"<\/span>: <span class=\"hljs-string\">\"Doe\"<\/span>, <span class=\"hljs-string\">\"posts\"<\/span>: &#91;]}\n<span class=\"hljs-keyword\">let<\/span> p2 = {<span class=\"hljs-string\">\"name\"<\/span>: <span class=\"hljs-string\">\"Mary\"<\/span>, <span class=\"hljs-string\">\"Surname\"<\/span>: <span class=\"hljs-string\">\"Smith\"<\/span>, <span class=\"hljs-string\">\"posts\"<\/span>: &#91;]}\n\ncompareByName(p1, p2)    <span class=\"hljs-comment\">\/\/Returns -1 in fact John &lt; Mary<\/span>\ncompareByName(p2, p1)    <span class=\"hljs-comment\">\/\/Returns +1 in fact Mary &gt; John<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>La stessa logica pu\u00f2 essere implementata per eseguire il confronto per numero di post pubblicati:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">let<\/span> compareByPosts = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>(<span class=\"hljs-params\">personA, personB<\/span>)<\/span>{\n    <span class=\"hljs-keyword\">if<\/span>(personA.posts.length &lt; personB.posts.length){ <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-number\">-1<\/span>}\n    <span class=\"hljs-keyword\">else<\/span> <span class=\"hljs-keyword\">if<\/span>(personA.posts.length &gt; personB.posts.length){ <span class=\"hljs-keyword\">return<\/span> +<span class=\"hljs-number\">1<\/span> }\n    <span class=\"hljs-keyword\">else<\/span> { <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-number\">0<\/span> }\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Ora \u00e8 sufficiente definire la high-order function e passarle il metodo di confronto desiderato:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">selectionSort<\/span><span class=\"hljs-params\">(list, comparator)<\/span><\/span>{\n    <span class=\"hljs-keyword\">for<\/span>(let i = <span class=\"hljs-number\">0<\/span>; i &lt; <span class=\"hljs-keyword\">list<\/span>.length - <span class=\"hljs-number\">1<\/span>; i++){\n        <span class=\"hljs-keyword\">for<\/span>(let j = i+<span class=\"hljs-number\">1<\/span>; j &lt; <span class=\"hljs-keyword\">list<\/span>.length; j++){\n            <span class=\"hljs-keyword\">if<\/span>(comparator(<span class=\"hljs-keyword\">list<\/span>&#91;j], <span class=\"hljs-keyword\">list<\/span>&#91;i]) &lt; <span class=\"hljs-number\">0<\/span>){\n                tmp = <span class=\"hljs-keyword\">list<\/span>&#91;i];\n                <span class=\"hljs-keyword\">list<\/span>&#91;i] = <span class=\"hljs-keyword\">list<\/span>&#91;j]\n                <span class=\"hljs-keyword\">list<\/span>&#91;j] = tmp\n            }\n        }\n    }\n}\n\n<span class=\"hljs-comment\">\/\/ Sorting by name<\/span>\nselectionSort(people, compareByName)\n\n<span class=\"hljs-comment\">\/\/ Sorting by posts number<\/span>\nselectionSort(people, compareByPosts)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Siamo quindi riusciti a sfruttare due uniche high-order function che definiscono l&#8217;algoritmo di ordinamento dell&#8217;array e adottano metodi differenti per confrontare i diversi elementi. Il codice \u00e8 poco duplicato e facilmente estendibile, infatti, se si volesse aggiungere un nuovo criterio di ordinamento, per esempio il cognome, sar\u00e0 sufficiente implementare la funzione compareBySurname() e passarla come <em>comparator <\/em>ad una delle due high-order function.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Il linguaggio JavaScript \u00e8 sempre pi\u00f9 utilizzato anche lato server grazie alle numerose librerie di sviluppo disponibili. Ci\u00f2 comporta un considerevole aumento della complessit\u00e0 del codice che deve essere sempre pi\u00f9 aperto alle estensioni e chiuso verso le modifiche. Nel seguito dell&#8217;articolo verr\u00e0 mostrato come evitare la duplicazione del codice sfruttando le high-order function in&#8230; <a class=\"more-link\" href=\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/\">Read more<\/a><\/p>\n","protected":false},"author":264,"featured_media":32929,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[10263,10230],"tags":[10327,10256,10438],"collections":[11708],"class_list":{"0":"post-32818","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-backend-it","8":"category-linguaggi-programmazione","9":"tag-javascript-it","10":"tag-linguaggi","11":"tag-sviluppo-software-it","12":"collections-dalla-community","13":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Evitare la duplicazione del codice con le high-order function<\/title>\n<meta name=\"description\" content=\"Ecco come evitare la duplicazione del codice sfruttando le high-order function in JavaScript. Un problema da non sottovalutare!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Evitare la duplicazione del codice sfruttando le high-order function in JavaScript\" \/>\n<meta property=\"og:description\" content=\"Ecco come evitare la duplicazione del codice sfruttando le high-order function in JavaScript. Un problema da non sottovalutare!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-07T08:07:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-07T08:07:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1792\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Fabrizio Tedeschi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fabrizio Tedeschi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/\"},\"author\":{\"name\":\"Fabrizio Tedeschi\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/902dc65e0de8be950fb33d9af4fae7f3\"},\"headline\":\"Evitare la duplicazione del codice sfruttando le high-order function in JavaScript\",\"datePublished\":\"2025-05-07T08:07:35+00:00\",\"dateModified\":\"2025-05-07T08:07:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/\"},\"wordCount\":567,\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp\",\"keywords\":[\"JavaScript\",\"linguaggi\",\"sviluppo software\"],\"articleSection\":[\"Backend\",\"Linguaggi di programmazione\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/\",\"name\":\"Evitare la duplicazione del codice con le high-order function\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp\",\"datePublished\":\"2025-05-07T08:07:35+00:00\",\"dateModified\":\"2025-05-07T08:07:38+00:00\",\"description\":\"Ecco come evitare la duplicazione del codice sfruttando le high-order function in JavaScript. Un problema da non sottovalutare!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#primaryimage\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp\",\"width\":1792,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Backend\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Evitare la duplicazione del codice sfruttando le high-order function in JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Codemotion.Italy\/\",\"https:\/\/x.com\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/902dc65e0de8be950fb33d9af4fae7f3\",\"name\":\"Fabrizio Tedeschi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/08\/IMG_9703-min-100x100.jpg\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/08\/IMG_9703-min-100x100.jpg\",\"caption\":\"Fabrizio Tedeschi\"},\"url\":\"https:\/\/www.codemotion.com\/magazine\/author\/fabriziot\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Evitare la duplicazione del codice con le high-order function","description":"Ecco come evitare la duplicazione del codice sfruttando le high-order function in JavaScript. Un problema da non sottovalutare!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Evitare la duplicazione del codice sfruttando le high-order function in JavaScript","og_description":"Ecco come evitare la duplicazione del codice sfruttando le high-order function in JavaScript. Un problema da non sottovalutare!","og_url":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2025-05-07T08:07:35+00:00","article_modified_time":"2025-05-07T08:07:38+00:00","og_image":[{"width":1792,"height":1024,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp","type":"image\/webp"}],"author":"Fabrizio Tedeschi","twitter_card":"summary_large_image","twitter_creator":"@CodemotionIT","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Fabrizio Tedeschi","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/"},"author":{"name":"Fabrizio Tedeschi","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/902dc65e0de8be950fb33d9af4fae7f3"},"headline":"Evitare la duplicazione del codice sfruttando le high-order function in JavaScript","datePublished":"2025-05-07T08:07:35+00:00","dateModified":"2025-05-07T08:07:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/"},"wordCount":567,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp","keywords":["JavaScript","linguaggi","sviluppo software"],"articleSection":["Backend","Linguaggi di programmazione"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/","url":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/","name":"Evitare la duplicazione del codice con le high-order function","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp","datePublished":"2025-05-07T08:07:35+00:00","dateModified":"2025-05-07T08:07:38+00:00","description":"Ecco come evitare la duplicazione del codice sfruttando le high-order function in JavaScript. Un problema da non sottovalutare!","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp","width":1792,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/evitare-la-duplicazione-del-codice-sfruttando-le-high-order-function-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"Backend","item":"https:\/\/www.codemotion.com\/magazine\/it\/backend-it\/"},{"@type":"ListItem","position":3,"name":"Evitare la duplicazione del codice sfruttando le high-order function in JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/902dc65e0de8be950fb33d9af4fae7f3","name":"Fabrizio Tedeschi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/08\/IMG_9703-min-100x100.jpg","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/08\/IMG_9703-min-100x100.jpg","caption":"Fabrizio Tedeschi"},"url":"https:\/\/www.codemotion.com\/magazine\/author\/fabriziot\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--600x400.webp","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--600x600.webp","author_info":{"display_name":"Fabrizio Tedeschi","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/fabriziot\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp",1792,1024,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--150x150.webp",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--300x171.webp",300,171,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--768x439.webp",768,439,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--1024x585.webp",1024,585,true],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--1536x878.webp",1536,878,true],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a-.webp",1792,1024,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--100x100.webp",100,100,true],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--180x128.webp",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--896x504.webp",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--400x225.webp",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--600x400.webp",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2025\/04\/DALL\u00b7E-2025-05-07-10.04.07-An-image-representing-the-concept-of-avoiding-code-duplication-by-using-high-order-functions-in-JavaScript.-The-scene-shows-a-programmer-working-on-a--600x600.webp",600,600,true]},"uagb_author_info":{"display_name":"Fabrizio Tedeschi","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/fabriziot\/"},"uagb_comment_info":0,"uagb_excerpt":"Il linguaggio JavaScript \u00e8 sempre pi\u00f9 utilizzato anche lato server grazie alle numerose librerie di sviluppo disponibili. Ci\u00f2 comporta un considerevole aumento della complessit\u00e0 del codice che deve essere sempre pi\u00f9 aperto alle estensioni e chiuso verso le modifiche. Nel seguito dell&#8217;articolo verr\u00e0 mostrato come evitare la duplicazione del codice sfruttando le high-order function in&#8230;&hellip;","lang":"it","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/32818","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/264"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=32818"}],"version-history":[{"count":2,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/32818\/revisions"}],"predecessor-version":[{"id":32931,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/32818\/revisions\/32931"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/32929"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=32818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=32818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=32818"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=32818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}