{"id":3501,"date":"2022-06-07T07:34:24","date_gmt":"2022-06-07T07:34:24","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/functional-programming-in-javascript-part-2-combinators\/"},"modified":"2026-03-11T06:01:32","modified_gmt":"2026-03-11T06:01:32","slug":"sila-funkcionalniho-programovani-v-javascriptu-cast-2-kombinatory","status":"publish","type":"post","link":"https:\/\/thecodest.co\/cs\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/","title":{"rendered":"Funk\u010dn\u00ed programov\u00e1n\u00ed v JavaScript, \u010d\u00e1st 2 - Kombin\u00e1tory"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction to Combinators<\/h2>\n\n\n\n<p>Combinators are higher-level function that allows you to combine functions, variables, or other combinators. Usually, they do not contain declarations of their own variables or business logic. They are the only ones to flush the control in a function program.<\/p>\n\n\n\n<p>In this article, I will try to cover a few of them:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Tap<\/li>\n\n\n\n<li>Currying<\/li>\n\n\n\n<li>Pipe\/Compose<\/li>\n\n\n\n<li>Fork<\/li>\n\n\n\n<li>Alternation<\/li>\n\n\n\n<li>Sequence<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Tap<\/h2>\n\n\n\n<p>A combinator is very useful for functions that return nothing. It takes the function to which the parameter goes and then it is returned.<\/p>\n\n\n\n<p><b>Declaration<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const tap = (fn) => (value) => {\nfn(value);\nreturn value;\n};<\/code><\/pre>\n\n\n\n<p><b>Imperative example<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const [items, setItems] = useState(() => [])\n\naxios\n.get('http:\/\/localhost')\n.then({ <a href=\"https:\/\/thecodest.co\/cs\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">data<\/a> } => {\nsetItems(data)\nconsole.log(data)\nonLoadData(data)\n}).then(...) \/\/ returns undefined - the data in the promise has been modified<\/code><\/pre>\n\n\n\n<p><b>Declarative example<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const [items, setItems] = useState(() => [])\n\naxios\n.get('http:\/\/localhost')\n.then(({ data }) => data)\n.then(tap(setItems)) \/\/ (data) => { setItems(data); return data }\n.then(tap(console.log)) \/\/ one then = one function = one responsibility\n.then(tap(onLoadData))\n.then(...) \/\/ still access to original data\n\/\/ easy on maintain open\/close principle<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Currying<\/h2>\n\n\n\n<p>It splits the arguments of a function and makes it possible to call them sequentially.<\/p>\n\n\n\n<p><b>Declaration<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const curry = (fn) => {\nconst curried = (...args) => {\nif (fn.length !== args.length){\nreturn curried.bind(null, ...args)\n}\nreturn fn(...args);\n};\n\nreturn curried\n\n};<\/code><\/pre>\n\n\n\n<p><br><b>Example<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const curry = (fn) => {\nconst curried = (...args) => {\nif (fn.length !== args.length){\nreturn curried.bind(null, ...args)\n}\nreturn fn(...args);\n};\n\nreturn curried\n\n};<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const sum = (a, b, c) => a + b + c\n\nconst currySum = curry(sum)\n\/*\npossible calls\ncurrySum(a)(b)(c),\ncurrySum(a)(b,c),\ncurrySum(a,b)(c),\ncurrySum(a,b,c)\n*\/\n\ncurrySum(1) \/\/ (b, c) => 1 + a + b or (b) => (c) => 1 + a + b\ncurrySum(5)(10) \/\/ (c) => 5 + 10 + b\ncurrySum(5, 10) \/\/ (c) => 5 + 10 + b\ncurrySum(5)(10)(20) \/\/ 35\ncurrySum(5, 10)(20) \/\/ 35\ncurrySum(5)(10, 20) \/\/ 35\n\nconst divideBy = curry((a, b) => b \/ a)\nconst multiplyBy = curry((a, b) => a * b)\n\nconst divideByTwo = divideBy(2)\ndivideByTwo(10) \/\/ returns 5\n\nconst multiplyByFive = multiplyBy(5)\nmultiplyByFive(10) \/\/ returns 50<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Pipe\/Compose<\/h2>\n\n\n\n<p>Through composition, it is possible to pass data from one function to another. It is important that the functions take the same number of arguments. The difference between pipe and compose is that the first one executes the function from first to the last, and compose calls them from the end.<\/p>\n\n\n\n<p><b>Declaration<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const pipe = (...fns) => (value, ...args) =>\nfns.reduce((v, f, i) =>\ni === 0\n? f(v, ...args)\n: f(v),\nvalue);\n\nconst compose = (...fns) => (value, ...args) =>\nfns.reduceRight((v, f, i) =>\ni === (fns.length - 1)\n? f(v, ...args)\n: f(v),\nvalue);<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const pipe = (...fns) => (value, ...args) =>\nfns.reduce((v, f, i) =>\ni === 0\n? f(v, ...args)\n: f(v),\nvalue);\n\nconst compose = (...fns) => (value, ...args) =>\nfns.reduceRight((v, f, i) =>\ni === (fns.length - 1)\n? f(v, ...args)\n: f(v),\nvalue);<\/code><\/pre>\n\n\n\n<p><b>Imperative example<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\"><code>const sine = (val) => Math.sin(val * Math.PI \/ 180) \/\/ not readable\n sine(90) \/\/ returns 1<\/code><\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><b>Declarative example<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const sine = pipe(\nmultiplyBy(Math.PI) \/\/ \u2193 val * Math.PI\ndivideBy(180), \/\/ \u2193 val * Math.PI \/ 180\nMath.sin, \/\/ \u2193 Math.sin(val * Math.PI \/ 180)\n)\n\nconst sine = compose(\nMath.sin, \/\/ \u2191 Math.sin(val * Math.PI \/ 180)\ndivideBy(180), \/\/ \u2191 val * Math.PI \/ 180\nmultiplyBy(Math.PI) \/\/ \u2191 val * Math.PI\n)\n\nsine(90) \/\/ returns 1<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Fork<\/h2>\n\n\n\n<p>The fork combiner is useful in situations where you want to process a value in two ways and combine the result.<\/p>\n\n\n\n<p><b>Declaration<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\"><code>const fork = (join, fn1, fn2) => (value) => join(fn1(value), fn2(value));<\/code><\/code><\/pre>\n\n\n\n<p><b>Example<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const length = (array) => array.length\nconst sum = (array) => array.reduce((a, b) => a + b, 0)\nconst divide = (a, b) => a \/ b\n\nconst arithmeticAverage = fork(divide, sum, length)\n\narithmeticAverage([5, 3, 2, 8, 4, 2]) \/\/ returns 4<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Alternation<\/h2>\n\n\n\n<p>This combinator takes two functions and returns the result of the first if true. Otherwise, it returns the result of the second function.<\/p>\n\n\n\n<p><b>Declaration<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\"><code><code>const alt = (fn, orFn) => (value) => fn(value) || orFn(value)<\/code><\/code><\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><b>Example<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const users = [{\nuuid: '123e4567-e89b-12d3-a456-426655440000',\nname: 'William'\n}]\n\nconst findUser = ({ uuid: searchesUuid }) =>\nusers.find(({ uuid }) => uuid === searchesUuid)\n\nconst newUser = data => ({ ...data, uuid: uuid() \/\/ create new uuid })\n\nconst findOrCreate = alt(findUser, newUser)\n\nfindOrCreate({ uuid: '123e4567-e89b-12d3-a456-426655440000' }) \/\/ returns William object\nfindOrCreate({ name: 'John' }) \/\/ returns John object with new uuid<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Sequence<\/h2>\n\n\n\n<p>It accepts many independent functions and passes the same parameter to each of them. Typically, these functions do not return any value.<\/p>\n\n\n\n<p><b>Declaration<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\"><code><code>const seq = (...fns) => (val) => fns.forEach(fn => fn(val))<\/code><\/code><\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><b> Example <\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const appendUser = (id) => ({ name }) => {\ndocument.getElementById(id).innerHTML = name\n}\n\nconst printUserContact = pipe(\nfindOrCreate, \/\/ returns user\nseq(\nappendUser('#contact'), \/\/ user => void\nconsole.log, \/\/ user => void\nonContactUpdate \/\/ user => void\n)\n)\n\nprintUserContact(userData)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/thecodest.co\/contact\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/interested_in_cooperation_.png\" alt=\"cooperation banner\"\/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Toto je druh\u00fd d\u00edl na\u0161\u00ed s\u00e9rie \u010dl\u00e1nk\u016f v\u011bnovan\u00fdch s\u00edle funkcion\u00e1ln\u00edho programov\u00e1n\u00ed v JavaScript. Pod\u00edvejte se na tento \u010dl\u00e1nek a roz\u0161i\u0159te si sv\u00e9 znalosti o kombin\u00e1torech.<\/p>","protected":false},"author":2,"featured_media":3137,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-3501","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Functional programming in JavaScript Part 2 - Combinators - The Codest<\/title>\n<meta name=\"description\" content=\"This is a second part of our series of articles devoted to power of functional programming in JavaScript. Check this article to expand your knowledge on Combinators.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/cs\/blog\/sila-funkcionalniho-programovani-v-javascriptu-cast-2-kombinatory\/\" \/>\n<meta property=\"og:locale\" content=\"cs_CZ\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Functional programming in JavaScript Part 2 - Combinators\" \/>\n<meta property=\"og:description\" content=\"This is a second part of our series of articles devoted to power of functional programming in JavaScript. Check this article to expand your knowledge on Combinators.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/cs\/blog\/sila-funkcionalniho-programovani-v-javascriptu-cast-2-kombinatory\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-07T07:34:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-11T06:01:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_2_-_combinators.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"thecodest\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"thecodest\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"Functional programming in JavaScript Part 2 &#8211; Combinators\",\"datePublished\":\"2022-06-07T07:34:24+00:00\",\"dateModified\":\"2026-03-11T06:01:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/\"},\"wordCount\":250,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_2_-_combinators.png\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"cs-CZ\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/\",\"name\":\"Functional programming in JavaScript Part 2 - Combinators - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_2_-_combinators.png\",\"datePublished\":\"2022-06-07T07:34:24+00:00\",\"dateModified\":\"2026-03-11T06:01:32+00:00\",\"description\":\"This is a second part of our series of articles devoted to power of functional programming in JavaScript. Check this article to expand your knowledge on Combinators.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/#breadcrumb\"},\"inLanguage\":\"cs-CZ\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"cs-CZ\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_2_-_combinators.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_2_-_combinators.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/power-of-functional-programming-in-javascript-part-2-combinators\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Functional programming in JavaScript Part 2 &#8211; Combinators\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"cs-CZ\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"cs-CZ\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\",\"name\":\"thecodest\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"cs-CZ\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"caption\":\"thecodest\"},\"url\":\"https:\\\/\\\/thecodest.co\\\/cs\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Funk\u010dn\u00ed programov\u00e1n\u00ed v JavaScript - 2. \u010d\u00e1st - Kombin\u00e1tory - The Codest","description":"Toto je druh\u00fd d\u00edl na\u0161\u00ed s\u00e9rie \u010dl\u00e1nk\u016f v\u011bnovan\u00fdch s\u00edle funkcion\u00e1ln\u00edho programov\u00e1n\u00ed v JavaScript. Pod\u00edvejte se na tento \u010dl\u00e1nek a roz\u0161i\u0159te si sv\u00e9 znalosti o kombin\u00e1torech.","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:\/\/thecodest.co\/cs\/blog\/sila-funkcionalniho-programovani-v-javascriptu-cast-2-kombinatory\/","og_locale":"cs_CZ","og_type":"article","og_title":"Functional programming in JavaScript Part 2 - Combinators","og_description":"This is a second part of our series of articles devoted to power of functional programming in JavaScript. Check this article to expand your knowledge on Combinators.","og_url":"https:\/\/thecodest.co\/cs\/blog\/sila-funkcionalniho-programovani-v-javascriptu-cast-2-kombinatory\/","og_site_name":"The Codest","article_published_time":"2022-06-07T07:34:24+00:00","article_modified_time":"2026-03-11T06:01:32+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_2_-_combinators.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"Functional programming in JavaScript Part 2 &#8211; Combinators","datePublished":"2022-06-07T07:34:24+00:00","dateModified":"2026-03-11T06:01:32+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/"},"wordCount":250,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_2_-_combinators.png","articleSection":["Software Development"],"inLanguage":"cs-CZ","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/","url":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/","name":"Funk\u010dn\u00ed programov\u00e1n\u00ed v JavaScript - 2. \u010d\u00e1st - Kombin\u00e1tory - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_2_-_combinators.png","datePublished":"2022-06-07T07:34:24+00:00","dateModified":"2026-03-11T06:01:32+00:00","description":"Toto je druh\u00fd d\u00edl na\u0161\u00ed s\u00e9rie \u010dl\u00e1nk\u016f v\u011bnovan\u00fdch s\u00edle funkcion\u00e1ln\u00edho programov\u00e1n\u00ed v JavaScript. Pod\u00edvejte se na tento \u010dl\u00e1nek a roz\u0161i\u0159te si sv\u00e9 znalosti o kombin\u00e1torech.","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/#breadcrumb"},"inLanguage":"cs-CZ","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/"]}]},{"@type":"ImageObject","inLanguage":"cs-CZ","@id":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_2_-_combinators.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_2_-_combinators.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"Functional programming in JavaScript Part 2 &#8211; Combinators"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"The Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"cs-CZ"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"cs-CZ","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]},{"@type":"Person","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76","name":"thecodest","image":{"@type":"ImageObject","inLanguage":"cs-CZ","@id":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","caption":"thecodest"},"url":"https:\/\/thecodest.co\/cs\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts\/3501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/comments?post=3501"}],"version-history":[{"count":6,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts\/3501\/revisions"}],"predecessor-version":[{"id":8380,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts\/3501\/revisions\/8380"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/media\/3137"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/media?parent=3501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/categories?post=3501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/tags?post=3501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}