{"id":13710336,"url":"https://github.com/DrBoolean/immutable-ext","last_synced_at":"2025-05-06T19:30:48.169Z","repository":{"id":44331525,"uuid":"54686525","full_name":"DrBoolean/immutable-ext","owner":"DrBoolean","description":"fantasyland extensions for immutablejs","archived":false,"fork":false,"pushed_at":"2019-02-10T20:33:36.000Z","size":74,"stargazers_count":488,"open_issues_count":5,"forks_count":20,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-05T23:08:52.488Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DrBoolean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-25T01:48:57.000Z","updated_at":"2025-02-16T16:41:50.000Z","dependencies_parsed_at":"2022-07-19T14:37:59.787Z","dependency_job_id":null,"html_url":"https://github.com/DrBoolean/immutable-ext","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrBoolean%2Fimmutable-ext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrBoolean%2Fimmutable-ext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrBoolean%2Fimmutable-ext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrBoolean%2Fimmutable-ext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DrBoolean","download_url":"https://codeload.github.com/DrBoolean/immutable-ext/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252753186,"owners_count":21798930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T23:00:54.664Z","updated_at":"2025-05-06T19:30:47.702Z","avatar_url":"https://github.com/DrBoolean.png","language":"JavaScript","readme":"# immutable-ext\nfantasyland extensions for immutablejs\n\n# Install\n`npm install immutable-ext`\n\n\n# What is this?\n\nIn addition to the Functor, Foldable, and Monad functions, we now have:\n * Monoid\n * Applicative (list only right now)\n * Traversable\n\nPlus stuff that builds off of reduce like `foldMap`. Please contribute/complain as you want/need things.\n\n## Examples\n\nWe can now traverse without messing with Array or Object:\n\n```js\n  const { List, Map } = require('immutable-ext')\n  const Task = require('data.task')\n  const IO = require('fantasy-io')\n\n\n  // Given Http.get :: String -\u003e Task Error Blog\n\n  List.of('/blog/1', '/blog/2')\n    .traverse(Task.of, Http.get)\n    .fork(console.error, console.log)\n  // List(Blog, Blog)\n\n\n  Map({home: \"\u003cdiv\u003ehomepage\u003c/div\u003e\", faq: \"\u003cp\u003eask me anything\u003c/p\u003e\"})\n    .traverse(IO.of, (v, k) =\u003e new IO(v =\u003e $('body').append(v)))\n\n  // IO(Map({home: \"[dom]\", faq: \"[dom]\"})\n```\n\nWe can `fold` stuff down\n\n```js\nconst {Disjunction, Additive} = require('fantasy-monoids')\n\nList.of([1,2,3], [4,5,6]).fold([])\n//[1,2,3,4,5,6]\n\nMap({a: \"hidy\", b: \"hidy\", c: \"ho\"}).fold(\"\")\n// \"hidyhidyho\"\n\n\nList.of(Map({a: Additive(1), b: Disjunction(true), c: \"son\", d: [1], e: 'wut'}),\n        Map({a: Additive(2), b: Disjunction(false), c: \"ofa\", d: [2]}),\n        Map({a: Additive(3), b: Disjunction(false), c: \"gun\", d: [3]})).fold(Map.empty),\n\n// Map({a: Additive(6), b: Disjunction(true), c: \"sonofagun\", d: [1,2,3], e: 'wut'})))\n```\n\n`foldMap` some things\n\n```js\nList.of(1,2,3,4).foldMap(Additive, Additive.empty)\n// Additive(10)\n\nMap({a: true, b: false}).foldMap(Disjunction, Disjunction.empty)\n// Disjunction(true)\n```\n\nWe can `ap` to get us some list comprehensions\n\n```js\nList.of(x =\u003e y =\u003e x + y)\n    .ap(List.of('a', 'b', 'c'))\n    .ap(List.of('+', '-'))\n\n// List('a+', 'a-', 'b+', 'b-', 'c+', 'c-')\n```\n","funding_links":[],"categories":["[JavaScript](#javascript)","Libraries"],"sub_categories":["[Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)","Algebraic Data Types"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDrBoolean%2Fimmutable-ext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDrBoolean%2Fimmutable-ext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDrBoolean%2Fimmutable-ext/lists"}