{"id":3502,"date":"2022-06-21T14:00:00","date_gmt":"2022-06-21T14:00:00","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/"},"modified":"2026-03-11T05:59:01","modified_gmt":"2026-03-11T05:59:01","slug":"programowanie-funkcyjne-w-javascript-czesc-3-funktor-monada-moze","status":"publish","type":"post","link":"https:\/\/thecodest.co\/pl\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/","title":{"rendered":"Programowanie funkcyjne w JavaScript Cz\u0119\u015b\u0107 3 - Funktor i Monada Maybe"},"content":{"rendered":"<h2 class=\"wp-block-heading\">Wprowadzenie<\/h2>\n\n\n\n<p>Cz\u0119sto utrzymanie niemodyfikowalno\u015bci jest trudne do utrzymania. Wzorzec zawijania <a href=\"https:\/\/thecodest.co\/pl\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">dane<\/a> do kontenera przychodzi na ratunek. Zabezpiecza on warto\u015bci, dzi\u0119ki czemu korzystanie z nich jest bezpieczne i nie powoduje skutk\u00f3w ubocznych.<\/p>\n\n\n\n<p>Je\u015bli jeste\u015b tu nowy, koniecznie sprawd\u017a moje ostatnie 2 cz\u0119\u015bci dotycz\u0105ce programowania funkcjonalnego na <a href=\"https:\/\/thecodest.co\/pl\/blog\/vibrant-upturn-charting-the-resolute-rise-of-swedish-firms\/\">The Codest<\/a> blog o:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-1-introduction\">Cz\u0119\u015b\u0107 1 - Wprowadzenie<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/thecodest.co\/blog\/power-of-functional-programming-in-javascript-part-2-combinators\">Cz\u0119\u015b\u0107 2 - Kombinatory<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Funktor<\/h2>\n\n\n\n<p>Nie ma z\u0142o\u017conej logiki. Jego g\u0142\u00f3wnym zadaniem jest opakowywanie kontekstu i wykonywanie na nim funkcji, kt\u00f3re otrzymuje z zewn\u0105trz. Za ka\u017cdym razem, gdy zmienia si\u0119 warto\u015b\u0107, nowa instancja kontenera jest przepakowywana i zwracana. Podczas wywo\u0142ywania funkcji <b>mapa<\/b> kt\u00f3ra wykonuje okre\u015blon\u0105 akcj\u0119, zwraca now\u0105 instancj\u0119 kontenera z warto\u015bci\u0105 zwr\u00f3con\u0105 przez przekazan\u0105 funkcj\u0119, zachowuj\u0105c zasad\u0119 niemodyfikowalno\u015bci.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Deklaracja<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\"><code> const Functor = value =&gt; ({\n     map: fn =&gt; Functor(fn(value)),\n     chain: fn =&gt; fn(value),\n     of: () =&gt; value\n });<\/code><\/code><\/pre>\n\n\n\n<p><b>mapa<\/b> - przydatna, gdy chcesz zmieni\u0107 stan warto\u015bci w kontenerze, ale nie chcesz jej jeszcze zwraca\u0107.<\/p>\n\n\n\n<p><b>\u0142a\u0144cuch<\/b> - u\u017cywany, je\u015bli chcesz przekaza\u0107 warto\u015b\u0107 do funkcji bez modyfikowania stanu kontenera. Zwykle na ko\u0144cu <b>mapa<\/b> po\u0142\u0105czenia.<\/p>\n\n\n\n<p><b>z<\/b> - zwraca bie\u017c\u0105c\u0105 warto\u015b\u0107<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Przyk\u0142ad imperatywu<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const randomInt = (max) =&gt; Math.floor(Math.random() * (max + 1))\n\nconst randomNumber = randomInt(200) \/\/ zwraca liczb\u0119 pomi\u0119dzy 0 a 200\n\ndecrease(randomNumber) \/\/ zwraca (liczb\u0119 pomi\u0119dzy 0 a 200) - 1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Przyk\u0142ad deklaratywny<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const randomIntWrapper = (max) =&gt;\nFunctor(max)\n.map(increase) \/\/ max + 1\n.map(multiplyBy(Math.random())) \/\/ Math.random() * (max + 1)\n.map(Math.floor) \/\/ Math.floor(Math.random() * (max + 1))\n\nconst randomNumber = randomIntWrapper(200)\n\nrandomNumber.of() \/\/ zwraca liczb\u0119 pomi\u0119dzy 0 a 200\nrandomNumber.chain(decrease) \/\/ zwraca (liczb\u0119 mi\u0119dzy 0 a 200) - 1<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Monada<\/h2>\n\n\n\n<p>Czasami, opr\u00f3cz funkcji wywo\u0142uj\u0105cych nowy stan warto\u015bci, potrzebna jest dodatkowa logika ukryta w kontenerze. Tutaj przydaje si\u0119 monada, kt\u00f3ra jest rozszerzeniem funkcji <b>funktor<\/b>. Mo\u017ce na przyk\u0142ad zdecydowa\u0107, co powinno si\u0119 sta\u0107, gdy warto\u015b\u0107 ma okre\u015blon\u0105 warto\u015b\u0107 lub jak\u0105 \u015bcie\u017ck\u0119 maj\u0105 obra\u0107 kolejne dzia\u0142ania.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Monada mo\u017ce<\/h2>\n\n\n\n<p>Monada by\u0107 mo\u017ce rozwi\u0105zuje problem warto\u015bci, kt\u00f3re nie zwracaj\u0105 prawdy. Kiedy tak si\u0119 dzieje, kolejne <b>mapa<\/b> s\u0105 ignorowane, ale umo\u017cliwia zwr\u00f3cenie alternatywy poprzez wywo\u0142anie funkcji <b>getOr<\/b> method. Pozwala to unikn\u0105\u0107 stosowania operator\u00f3w if \/ else, kt\u00f3re s\u0105 popularne w metodach <b>imperatywny<\/b> programowanie. Monada ta sk\u0142ada si\u0119 z trzech kontener\u00f3w:<\/p>\n\n\n\n<p><b>Nic<\/b> - uruchamia si\u0119, gdy warto\u015b\u0107, kt\u00f3ra nie jest prawdziwa, wpada do kontenera lub <strong>filtr<\/strong> zwraca warto\u015b\u0107 false. S\u0142u\u017cy do symulacji wykonania funkcji. Oznacza to, \u017ce ten kontener odbiera funkcj\u0119, ale jej nie wykonuje.<\/p>\n\n\n\n<p><b>Po prostu<\/b> - jest to g\u0142\u00f3wny kontener, kt\u00f3ry wykonuje wszystkie funkcje, ale je\u015bli warto\u015b\u0107 zmieni si\u0119 na warto\u015b\u0107 false lub <b>filtr<\/b> zwr\u00f3ci warto\u015b\u0107 false, przeka\u017ce j\u0105 do metody <b>Nic<\/b> pojemnik.<\/p>\n\n\n\n<p><b>Mo\u017ce<\/b> - Bior\u0119 warto\u015b\u0107 pocz\u0105tkow\u0105 i decyduj\u0119, kt\u00f3ry kontener wywo\u0142a\u0107 na pocz\u0105tku.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Deklaracja<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const Just = value =&gt; ({\nmap: fn =&gt; Maybe(fn(value)),\nchain: fn =&gt; fn(value),\nof: () =&gt; value,\ngetOr: () =&gt; value,\nfilter: fn =&gt; fn(value) ? Just(value) : Nothing(),\ntype: 'just'\n});\n\nconst Nothing = () =&gt; ({\nmap: fn =&gt; Nothing(),\nchain: fn =&gt; fn(),\nof: () =&gt; Nothing(),\ngetOr: substitute =&gt; substitute,\nfilter: () =&gt; Nothing(),\ntype: 'nothing'\n});\n\nconst Maybe = value =&gt;\nvalue == null || value == undefined || value.type == 'nothing'\n? Nothing()\n: Just(value)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/table.png\" alt=\"tabela metody funktor \" title=\"funktor tabeli \"\/><\/figure>\n\n\n\n<p>Rozbudujmy teraz poprzedni przyk\u0142ad o warunek. Je\u015bli warto\u015b\u0107 max jest wi\u0119ksza od zera, funkcja zostanie wykonana. W przeciwnym razie funkcja zwr\u00f3ci 0.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Przyk\u0142ad imperatywu<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const randomInt = (max) =&gt; {\nif(max &gt; 0) {\nreturn Math.floor(Math.random() * (max + 1))\n} else {\nreturn 0\n}\n}\n\nconst bookMiddlePage = 200\n\nconst randomPage = randomInt(10) || bookMiddlePage \/\/ zwraca losow\u0105 warto\u015b\u0107\nconst randomPage = randomInt(-10) || bookMiddlePage \/\/ zwraca 200<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Przyk\u0142ad deklaratywny<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const randomIntWrapper = (max) =&gt;\nMaybe(max)\n.filter(max =&gt; max &gt; 0) \/\/ warto\u015b\u0107 false ignoruje dalsze wywo\u0142ania\n.map(increase)\n.map(multiplyBy(Math.random()))\n.map(Math.floor)\n\nconst bookMiddlePage = 200\n\n\/\/ Tylko kontener\nconst randomPage = randomIntWrapper(10).getOr(bookMiddlePage) \/\/ zwraca losow\u0105 warto\u015b\u0107\n\/\/ Kontener bez niczego\nconst randomPage = randomIntWrapper(-10).getOr(bookMiddlePage) \/\/ zwraca 200<\/code><\/pre>\n\n\n\n<p><br><a href=\"https:\/\/thecodest.co\/contact\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/interested_in_cooperation_.png\" alt=\"baner wsp\u00f3\u0142pracy\"><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Sprawd\u017a trzeci\u0105 cz\u0119\u015b\u0107 naszej serii artyku\u0142\u00f3w Power of functional programming w JavaScript. Tym razem nasz ekspert JavaScript wyja\u015bnia wi\u0119cej na temat Functor i Monad Maybe.<\/p>","protected":false},"author":2,"featured_media":3503,"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-3502","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 3 - Functor &amp; Monad Maybe - The Codest<\/title>\n<meta name=\"description\" content=\"Check the third part of our Power of functional programming in JavaScript article series. This time our JavaScript expert explains more about Functor and Monad Maybe.\" \/>\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\/pl\/blog\/programowanie-funkcyjne-w-javascript-czesc-3-funktor-monada-moze\/\" \/>\n<meta property=\"og:locale\" content=\"pl_PL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Functional programming in JavaScript Part 3 - Functor &amp; Monad Maybe\" \/>\n<meta property=\"og:description\" content=\"Check the third part of our Power of functional programming in JavaScript article series. This time our JavaScript expert explains more about Functor and Monad Maybe.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/pl\/blog\/programowanie-funkcyjne-w-javascript-czesc-3-funktor-monada-moze\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-21T14:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-11T05:59:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.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=\"3 minuty\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"Functional programming in JavaScript Part 3 &#8211; Functor &#038; Monad Maybe\",\"datePublished\":\"2022-06-21T14:00:00+00:00\",\"dateModified\":\"2026-03-11T05:59:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/\"},\"wordCount\":437,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"pl-PL\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/\",\"name\":\"Functional programming in JavaScript Part 3 - Functor & Monad Maybe - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png\",\"datePublished\":\"2022-06-21T14:00:00+00:00\",\"dateModified\":\"2026-03-11T05:59:01+00:00\",\"description\":\"Check the third part of our Power of functional programming in JavaScript article series. This time our JavaScript expert explains more about Functor and Monad Maybe.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#breadcrumb\"},\"inLanguage\":\"pl-PL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pl-PL\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/functional-programming-in-javascript-part-3-functor-monad-maybe\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Functional programming in JavaScript Part 3 &#8211; Functor &#038; Monad Maybe\"}]},{\"@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\":\"pl-PL\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pl-PL\",\"@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\":\"pl-PL\",\"@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\\\/pl\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Programowanie funkcyjne w JavaScript Cz\u0119\u015b\u0107 3 - Funktor i Monada Maybe - The Codest","description":"Sprawd\u017a trzeci\u0105 cz\u0119\u015b\u0107 naszej serii artyku\u0142\u00f3w Power of functional programming w JavaScript. Tym razem nasz ekspert JavaScript wyja\u015bnia wi\u0119cej na temat Functor i Monad Maybe.","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\/pl\/blog\/programowanie-funkcyjne-w-javascript-czesc-3-funktor-monada-moze\/","og_locale":"pl_PL","og_type":"article","og_title":"Functional programming in JavaScript Part 3 - Functor & Monad Maybe","og_description":"Check the third part of our Power of functional programming in JavaScript article series. This time our JavaScript expert explains more about Functor and Monad Maybe.","og_url":"https:\/\/thecodest.co\/pl\/blog\/programowanie-funkcyjne-w-javascript-czesc-3-funktor-monada-moze\/","og_site_name":"The Codest","article_published_time":"2022-06-21T14:00:00+00:00","article_modified_time":"2026-03-11T05:59:01+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"3 minuty"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"Functional programming in JavaScript Part 3 &#8211; Functor &#038; Monad Maybe","datePublished":"2022-06-21T14:00:00+00:00","dateModified":"2026-03-11T05:59:01+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/"},"wordCount":437,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png","articleSection":["Software Development"],"inLanguage":"pl-PL","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/","url":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/","name":"Programowanie funkcyjne w JavaScript Cz\u0119\u015b\u0107 3 - Funktor i Monada Maybe - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png","datePublished":"2022-06-21T14:00:00+00:00","dateModified":"2026-03-11T05:59:01+00:00","description":"Sprawd\u017a trzeci\u0105 cz\u0119\u015b\u0107 naszej serii artyku\u0142\u00f3w Power of functional programming w JavaScript. Tym razem nasz ekspert JavaScript wyja\u015bnia wi\u0119cej na temat Functor i Monad Maybe.","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#breadcrumb"},"inLanguage":"pl-PL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/"]}]},{"@type":"ImageObject","inLanguage":"pl-PL","@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/power_of_functional_programming_in_javascript_part_3_-_functor_-_monad_maybe.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/functional-programming-in-javascript-part-3-functor-monad-maybe\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"Functional programming in JavaScript Part 3 &#8211; Functor &#038; Monad Maybe"}]},{"@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":"pl-PL"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"pl-PL","@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":"pl-PL","@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\/pl\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/posts\/3502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/comments?post=3502"}],"version-history":[{"count":8,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/posts\/3502\/revisions"}],"predecessor-version":[{"id":8386,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/posts\/3502\/revisions\/8386"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/media\/3503"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/media?parent=3502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/categories?post=3502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/tags?post=3502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}