{"id":21831369,"url":"https://github.com/nodef/extra-map","last_synced_at":"2025-04-14T07:08:27.571Z","repository":{"id":33828678,"uuid":"133659342","full_name":"nodef/extra-map","owner":"nodef","description":"A group of functions for working with Maps.","archived":false,"fork":false,"pushed_at":"2025-04-08T16:43:17.000Z","size":502,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T22:44:02.981Z","etag":null,"topics":["cartesian-product","chunk","compare","concat","count","count-as","difference","drop","entries","every","extra","filter","filter-at","find","map"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/extra-map","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-16T12:02:26.000Z","updated_at":"2025-04-08T16:43:18.000Z","dependencies_parsed_at":"2024-10-27T12:50:18.620Z","dependency_job_id":"ca46285a-4159-4eef-8a2c-e17d6cd5267d","html_url":"https://github.com/nodef/extra-map","commit_stats":{"total_commits":238,"total_committers":1,"mean_commits":238.0,"dds":0.0,"last_synced_commit":"a77a58e2c1fe89f8c9098cfe7c74294023771215"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodef","download_url":"https://codeload.github.com/nodef/extra-map/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492972,"owners_count":21113159,"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":["cartesian-product","chunk","compare","concat","count","count-as","difference","drop","entries","every","extra","filter","filter-at","find","map"],"created_at":"2024-11-27T19:10:02.268Z","updated_at":"2025-04-14T07:08:27.555Z","avatar_url":"https://github.com/nodef.png","language":"TypeScript","readme":"A group of functions for working with Maps.\u003cbr\u003e\n📦 [Node.js](https://www.npmjs.com/package/extra-map),\n🌐 [Web](https://www.npmjs.com/package/extra-map.web),\n📜 [Files](https://unpkg.com/extra-map/),\n📰 [Docs](https://nodef.github.io/extra-map/),\n📘 [Wiki](https://github.com/nodef/extra-map/wiki/).\n\nA [Map] is a collection of key-value pairs, with unique keys. This package\nincludes common set functions related to querying **about** map, **generating**\nthem, **comparing** one with another, finding their **size**, **adding** and\n**removing** entries, obtaining its **properties**, getting a **part** of it,\ngetting a **subset** entries in it, **finding** an entry in it, performing\n**functional** operations, **manipulating** it in various ways, **combining**\ntogether maps or its entries, of performing **set operations** upon it.\n\nAll functions except `from*()` take set as 1st parameter. Some names\nare borrowed from Haskell, Python, Java, Processing. Methods like\n`swap()` are pure and do not modify the map itself, while methods like\n`swap$()` *do modify (update)* the map itself.\n\nThis package is available in *Node.js* and *Web* formats. The web format\nis exposed as `extra_set` standalone variable and can be loaded from\n[jsDelivr CDN].\n\n\u003e Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).\n\n[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\n[jsDelivr CDN]: https://cdn.jsdelivr.net/npm/extra-map.web/index.js\n\n\u003cbr\u003e\n\n```javascript\nconst map = require('extra-map');\n// import * as map from \"extra-map\";\n// import * as map from \"https://unpkg.com/extra-map/index.mjs\"; (deno)\n\nvar x = new Map([[\"a\", 1], [\"b\", 2], [\"c\", 3], [\"d\", 4]]);\nmap.swap(x, \"a\", \"b\");\n// → Map(4) { \"a\" =\u003e 2, \"b\" =\u003e 1, \"c\" =\u003e 3, \"d\" =\u003e 4 }\n\nvar x = new Map([[\"a\", 1],  [\"b\", 2],  [\"c\", 3], [\"d\", 4]]);\nvar y = new Map([[\"b\", 20], [\"c\", 30], [\"e\", 50]]);\nmap.intersection(x, y);\n// → Map(2) { \"b\" =\u003e 2, \"c\" =\u003e 3 }\n\nvar x = new Map([[\"a\", 1], [\"b\", 2], [\"c\", 3], [\"d\", -2]]);\nmap.searchAll(x, v =\u003e Math.abs(v) === 2);\n// → [ \"b\", \"d\" ]              ^                   ^\n\nvar x = new Map([[\"a\", 1], [\"b\", 2], [\"c\", 3]]);\n[...map.subsets(x)];\n// → [\n// →   Map(0) {},\n// →   Map(1) { \"a\" =\u003e 1 },\n// →   Map(1) { \"b\" =\u003e 2 },\n// →   Map(2) { \"a\" =\u003e 1, \"b\" =\u003e 2 },\n// →   Map(1) { \"c\" =\u003e 3 },\n// →   Map(2) { \"a\" =\u003e 1, \"c\" =\u003e 3 },\n// →   Map(2) { \"b\" =\u003e 2, \"c\" =\u003e 3 },\n// →   Map(3) { \"a\" =\u003e 1, \"b\" =\u003e 2, \"c\" =\u003e 3 }\n// → ]\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## Index\n\n| Property | Description |\n|  ----  |  ----  |\n| [is] | Check if value is a map. |\n| [keys] | List all keys. |\n| [values] | List all values. |\n| [entries] | List all key-value pairs. |\n|  |  |\n| [from] | Convert entries to map. |\n| [from$] | Convert entries to map. |\n| [fromLists] | Convert lists to map. |\n| [fromKeys] | Create a map from keys. |\n| [fromValues] | Create a map from values. |\n|  |  |\n| [compare] | Compare two maps. |\n| [isEqual] | Check if two maps are equal. |\n|  |  |\n| [size] | Find the size of a map. |\n| [isEmpty] | Check if a map is empty. |\n|  |  |\n| [get] | Get value at key. |\n| [getAll] | Get values at keys. |\n| [getPath] | Get value at path in a nested map. |\n| [hasPath] | Check if nested map has a path. |\n| [set] | Set value at key. |\n| [set$] | Set value at key. |\n| [setPath$] | Set value at path in a nested map. |\n| [swap] | Exchange two values. |\n| [swap$] | Exchange two values. |\n| [remove] | Remove value at key. |\n| [remove$] | Remove value at key. |\n| [removePath$] | Remove value at path in a nested map. |\n|  |  |\n| [count] | Count values which satisfy a test. |\n| [countAs] | Count occurrences of values. |\n| [min] | Find smallest value. |\n| [minEntry] | Find smallest entry. |\n| [max] | Find largest value. |\n| [maxEntry] | Find largest entry. |\n| [range] | Find smallest and largest values. |\n| [rangeEntries] | Find smallest and largest entries. |\n|  |  |\n| [head] | Get first entry from map (default order). |\n| [tail] | Get a map without its first entry (default order). |\n| [take] | Keep first n entries only (default order). |\n| [take$] | Keep first n entries only (default order). |\n| [drop] | Remove first n entries (default order). |\n| [drop$] | Remove first n entries (default order). |\n|  |  |\n| [subsets] | List all possible subsets. |\n| [randomKey] | Pick an arbitrary key. |\n| [randomEntry] | Pick an arbitrary entry. |\n| [randomSubset] | Pick an arbitrary subset. |\n|  |  |\n| [has] | Check if map has a key. |\n| [hasValue] | Check if map has a value. |\n| [hasEntry] | Check if map has an entry. |\n| [hasSubset] | Check if map has a subset. |\n| [find] | Find first value passing a test (default order). |\n| [findAll] | Find values passing a test. |\n| [search] | Find key of an entry passing a test. |\n| [searchAll] | Find keys of entries passing a test. |\n| [searchValue] | Find a key with given value. |\n| [searchValueAll] | Find keys with given value. |\n|  |  |\n| [forEach] | Call a function for each value. |\n| [some] | Check if any value satisfies a test. |\n| [every] | Check if all values satisfy a test. |\n| [map] | Transform values of a map. |\n| [map$] | Transform values of a map. |\n| [reduce] | Reduce values of set to a single value. |\n| [filter] | Keep entries which pass a test. |\n| [filter$] | Keep entries which pass a test. |\n| [filterAt] | Keep values at given keys. |\n| [filterAt$] | Keep values at given keys. |\n| [reject] | Discard entries which pass a test. |\n| [reject$] | Discard entries which pass a test. |\n| [rejectAt] | Discard values at given keys. |\n| [rejectAt$] | Discard values at given keys. |\n| [flat] | Flatten nested map to given depth. |\n| [flatMap] | Flatten nested map, based on map function. |\n| [zip] | Combine matching entries from maps. |\n|  |  |\n| [partition] | Segregate entries by test result. |\n| [partitionAs] | Segregate entries by similarity. |\n| [chunk] | Break map into chunks of given size. |\n|  |  |\n| [concat] | Append entries from maps, preferring last. |\n| [concat$] | Append entries from maps, preferring last. |\n| [join] | Join entries together into a string. |\n|  |  |\n| [isDisjoint] | Check if maps have no common keys. |\n| [unionKeys] | Obtain keys present in any map. |\n| [union] | Obtain entries present in any map. |\n| [union$] | Obtain entries present in any map. |\n| [intersectionKeys] | Obtain keys present in all maps. |\n| [intersection] | Obtain entries present in both maps. |\n| [intersection$] | Obtain entries present in both maps. |\n| [difference] | Obtain entries not present in another map. |\n| [difference$] | Obtain entries not present in another map. |\n| [symmetricDifference] | Obtain entries not present in both maps. |\n| [symmetricDifference$] | Obtain entries not present in both maps. |\n| [cartesianProduct] | List cartesian product of maps. |\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n[![](https://img.youtube.com/vi/dMxIjGjMJz0/maxresdefault.jpg)](https://www.youtube.com/watch?v=dMxIjGjMJz0)\n[![ORG](https://img.shields.io/badge/org-nodef-green?logo=Org)](https://nodef.github.io)\n[![DOI](https://zenodo.org/badge/133659342.svg)](https://zenodo.org/badge/latestdoi/133659342)\n[![Coverage Status](https://coveralls.io/repos/github/nodef/extra-map/badge.svg?branch=master)](https://coveralls.io/github/nodef/extra-map?branch=master)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/6d1d66699747ff804674/test_coverage)](https://codeclimate.com/github/nodef/extra-map/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6d1d66699747ff804674/maintainability)](https://codeclimate.com/github/nodef/extra-map/maintainability)\n![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/extra-map)\n\n\n[is]: https://github.com/nodef/extra-map/wiki/is\n[keys]: https://github.com/nodef/extra-map/wiki/keys\n[values]: https://github.com/nodef/extra-map/wiki/values\n[entries]: https://github.com/nodef/extra-map/wiki/entries\n[from]: https://github.com/nodef/extra-map/wiki/from\n[from$]: https://github.com/nodef/extra-map/wiki/from$\n[fromLists]: https://github.com/nodef/extra-map/wiki/fromLists\n[fromKeys]: https://github.com/nodef/extra-map/wiki/fromKeys\n[fromValues]: https://github.com/nodef/extra-map/wiki/fromValues\n[compare]: https://github.com/nodef/extra-map/wiki/compare\n[isEqual]: https://github.com/nodef/extra-map/wiki/isEqual\n[size]: https://github.com/nodef/extra-map/wiki/size\n[isEmpty]: https://github.com/nodef/extra-map/wiki/isEmpty\n[get]: https://github.com/nodef/extra-map/wiki/get\n[getAll]: https://github.com/nodef/extra-map/wiki/getAll\n[getPath]: https://github.com/nodef/extra-map/wiki/getPath\n[hasPath]: https://github.com/nodef/extra-map/wiki/hasPath\n[set]: https://github.com/nodef/extra-map/wiki/set\n[set$]: https://github.com/nodef/extra-map/wiki/set$\n[setPath$]: https://github.com/nodef/extra-map/wiki/setPath$\n[swap]: https://github.com/nodef/extra-map/wiki/swap\n[swap$]: https://github.com/nodef/extra-map/wiki/swap$\n[remove]: https://github.com/nodef/extra-map/wiki/remove\n[remove$]: https://github.com/nodef/extra-map/wiki/remove$\n[removePath$]: https://github.com/nodef/extra-map/wiki/removePath$\n[count]: https://github.com/nodef/extra-map/wiki/count\n[countAs]: https://github.com/nodef/extra-map/wiki/countAs\n[min]: https://github.com/nodef/extra-map/wiki/min\n[minEntry]: https://github.com/nodef/extra-map/wiki/minEntry\n[max]: https://github.com/nodef/extra-map/wiki/max\n[maxEntry]: https://github.com/nodef/extra-map/wiki/maxEntry\n[range]: https://github.com/nodef/extra-map/wiki/range\n[rangeEntries]: https://github.com/nodef/extra-map/wiki/rangeEntries\n[head]: https://github.com/nodef/extra-map/wiki/head\n[tail]: https://github.com/nodef/extra-map/wiki/tail\n[take]: https://github.com/nodef/extra-map/wiki/take\n[take$]: https://github.com/nodef/extra-map/wiki/take$\n[drop]: https://github.com/nodef/extra-map/wiki/drop\n[drop$]: https://github.com/nodef/extra-map/wiki/drop$\n[subsets]: https://github.com/nodef/extra-map/wiki/subsets\n[randomKey]: https://github.com/nodef/extra-map/wiki/randomKey\n[randomEntry]: https://github.com/nodef/extra-map/wiki/randomEntry\n[randomSubset]: https://github.com/nodef/extra-map/wiki/randomSubset\n[has]: https://github.com/nodef/extra-map/wiki/has\n[hasValue]: https://github.com/nodef/extra-map/wiki/hasValue\n[hasEntry]: https://github.com/nodef/extra-map/wiki/hasEntry\n[hasSubset]: https://github.com/nodef/extra-map/wiki/hasSubset\n[find]: https://github.com/nodef/extra-map/wiki/find\n[findAll]: https://github.com/nodef/extra-map/wiki/findAll\n[search]: https://github.com/nodef/extra-map/wiki/search\n[searchAll]: https://github.com/nodef/extra-map/wiki/searchAll\n[searchValue]: https://github.com/nodef/extra-map/wiki/searchValue\n[searchValueAll]: https://github.com/nodef/extra-map/wiki/searchValueAll\n[forEach]: https://github.com/nodef/extra-map/wiki/forEach\n[some]: https://github.com/nodef/extra-map/wiki/some\n[every]: https://github.com/nodef/extra-map/wiki/every\n[map]: https://github.com/nodef/extra-map/wiki/map\n[map$]: https://github.com/nodef/extra-map/wiki/map$\n[reduce]: https://github.com/nodef/extra-map/wiki/reduce\n[filter]: https://github.com/nodef/extra-map/wiki/filter\n[filter$]: https://github.com/nodef/extra-map/wiki/filter$\n[filterAt]: https://github.com/nodef/extra-map/wiki/filterAt\n[filterAt$]: https://github.com/nodef/extra-map/wiki/filterAt$\n[reject]: https://github.com/nodef/extra-map/wiki/reject\n[reject$]: https://github.com/nodef/extra-map/wiki/reject$\n[rejectAt]: https://github.com/nodef/extra-map/wiki/rejectAt\n[rejectAt$]: https://github.com/nodef/extra-map/wiki/rejectAt$\n[flat]: https://github.com/nodef/extra-map/wiki/flat\n[flatMap]: https://github.com/nodef/extra-map/wiki/flatMap\n[zip]: https://github.com/nodef/extra-map/wiki/zip\n[partition]: https://github.com/nodef/extra-map/wiki/partition\n[partitionAs]: https://github.com/nodef/extra-map/wiki/partitionAs\n[chunk]: https://github.com/nodef/extra-map/wiki/chunk\n[concat]: https://github.com/nodef/extra-map/wiki/concat\n[concat$]: https://github.com/nodef/extra-map/wiki/concat$\n[join]: https://github.com/nodef/extra-map/wiki/join\n[isDisjoint]: https://github.com/nodef/extra-map/wiki/isDisjoint\n[unionKeys]: https://github.com/nodef/extra-map/wiki/unionKeys\n[union]: https://github.com/nodef/extra-map/wiki/union\n[union$]: https://github.com/nodef/extra-map/wiki/union$\n[intersectionKeys]: https://github.com/nodef/extra-map/wiki/intersectionKeys\n[intersection]: https://github.com/nodef/extra-map/wiki/intersection\n[intersection$]: https://github.com/nodef/extra-map/wiki/intersection$\n[difference]: https://github.com/nodef/extra-map/wiki/difference\n[difference$]: https://github.com/nodef/extra-map/wiki/difference$\n[symmetricDifference]: https://github.com/nodef/extra-map/wiki/symmetricDifference\n[symmetricDifference$]: https://github.com/nodef/extra-map/wiki/symmetricDifference$\n[cartesianProduct]: https://github.com/nodef/extra-map/wiki/cartesianProduct\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodef%2Fextra-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-map/lists"}