{"id":21356768,"url":"https://github.com/rousan/collections-es6","last_synced_at":"2025-10-11T18:14:34.571Z","repository":{"id":57203180,"uuid":"94207711","full_name":"rousan/collections-es6","owner":"rousan","description":":gift: ES6 Map, Set, WeakMap and WeakSet polyfill in pure ES5","archived":false,"fork":false,"pushed_at":"2018-02-18T09:49:11.000Z","size":56,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-04T14:13:22.654Z","etag":null,"topics":["collections","es5","es6","es6-collections","es6-map","es6-set","es6-weakmap","es6-weakset","harmony","harmony-collections","map","polyfills","ponyfills","set","weakmap","weakset"],"latest_commit_sha":null,"homepage":"https://rousan.io/collections-es6/","language":"JavaScript","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/rousan.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":"2017-06-13T11:54:35.000Z","updated_at":"2022-10-30T18:32:06.000Z","dependencies_parsed_at":"2022-09-16T14:21:13.866Z","dependency_job_id":null,"html_url":"https://github.com/rousan/collections-es6","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/rousan/collections-es6","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rousan%2Fcollections-es6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rousan%2Fcollections-es6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rousan%2Fcollections-es6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rousan%2Fcollections-es6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rousan","download_url":"https://codeload.github.com/rousan/collections-es6/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rousan%2Fcollections-es6/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260708211,"owners_count":23049969,"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":["collections","es5","es6","es6-collections","es6-map","es6-set","es6-weakmap","es6-weakset","harmony","harmony-collections","map","polyfills","ponyfills","set","weakmap","weakset"],"created_at":"2024-11-22T04:36:06.663Z","updated_at":"2025-10-11T18:14:34.487Z","avatar_url":"https://github.com/rousan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version](https://img.shields.io/npm/v/collections-es6.svg)](https://www.npmjs.com/package/collections-es6)\n[![NPM total downloads](https://img.shields.io/npm/dt/collections-es6.svg)](https://www.npmjs.com/package/collections-es6)\n[![License](https://img.shields.io/github/license/rousan/collections-es6.svg)](https://github.com/rousan/collections-es6/blob/master/LICENSE)\n\n# Collections-ES6\n\nProvides support for `ES6` `Map`, `Set`, `WeakMap` and `WeakSet` in `ES5` for older JS environments i.e. older browsers or `NodeJS`.\n\n\u003e ES6 Map, Set, WeakMap and WeakSet polyfill in pure ES5.\n\n## Install\n\nIt depends on [symbol-es6](https://github.com/rousan/symbol-es6) module, so you need to include both.\n\n### NPM\n\nInstall it from `npm` and `require` it before any other modules:\n\n```bash\n$ npm install --save collections-es6\n```\n\n```javascript\nrequire(\"symbol-es6\");\nrequire(\"collections-es6\");\n```\n\n### CDN\n\nIf you prefer CDN, then just insert it into your HTML page on the top of other scripts:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/symbol-es6/dist/symbol-es6.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/collections-es6/dist/collections-es6.min.js\"\u003e\u003c/script\u003e\n```\n\n## Examples\n\n```javascript\n\"use strict\";\n\nvar ES6 = require(\"symbol-es6\");\nES6 = require(\"collections-es6\");\n\n\nvar map = new Map([[1, 2], [\"Hi\", \"Hello World\"]]);\n\nconsole.log(map.has(1)); //true\nconsole.log(map.has(\"Hi\")); //true\n\nmap.set(NaN, \"NaN\");\nmap.set(NaN, \"Again NaN!\");\nmap.set(0, \"Zero\");\nmap.set(-0, \"Again Zero!\");\n\nconsole.log(map.size); //4\nconsole.log(map.has(NaN)); //true\nconsole.log(map.size); //4\nconsole.log(map.has(0)); //true\nconsole.log(map.has(-0)); //true\n\nvar set = new Set([NaN, 0, -0, \"Hi\", \"Hello World\"]);\nset.add(Infinity);\n\nconsole.log(set.has(NaN)); //true\nconsole.log(set.has(\"Hi\")); //true\nconsole.log(set.size); //5\nconsole.log(set.has(Infinity)); //true\nconsole.log(set.has(-Infinity)); //false\n\nvar wm = new WeakMap();\nwm.set(Object, \"object\");\nwm.set(Function, \"function\");\nwm.set({}, \"new Object\");\n\nconsole.log(wm.has(Object)); //true\nconsole.log(wm.has({})); //false\n\nvar ws = new WeakSet();\nws.add(Function);\nws.add({});\n\nconsole.log(ws.has({})); //false\nconsole.log(ws.has(Function)); //true\n\nconsole.log(ES6.isMap(map)); //true\nconsole.log(ES6.isSet(set)); //true\nconsole.log(ES6.isWeakMap(wm)); //true\nconsole.log(ES6.isWeakSet(ws)); //true\n```\n\n## Polyfills\n\n* `Map`\n\n    * `Map.prototype.size`\n    * `Map.prototype.set()`\n    * `Map.prototype.get()`\n    * `Map.prototype.has()`\n    * `Map.prototype.clear()`\n    * `Map.prototype.delete()`\n    * `Map.prototype.entries()`\n    * `Map.prototype.forEach()`\n    * `Map.prototype.keys()`\n    * `Map.prototype.values()`\n    * `Map.prototype[@@iterator]()`\n    * `Map.prototype[@@toStringTag]()`\n    \n* `Set`\n    * `Set.prototype.size`\n    * `Set.prototype.add()`\n    * `Set.prototype.clear()`\n    * `Set.prototype.delete()`\n    * `Set.prototype.entries()`\n    * `Set.prototype.forEach()`\n    * `Set.prototype.has()`\n    * `Set.prototype.keys()`\n    * `Set.prototype.values()`\n    * `Set.prototype[@@iterator]()`\n    * `Set.prototype[@@toStringTag]()`\n    \n* `WeakMap`\n\n    * `WeakMap.prototype.delete()`\n    * `WeakMap.prototype.get()`\n    * `WeakMap.prototype.has()`\n    * `WeakMap.prototype.set()`\n    * `WeakMap.prototype[@@toStringTag]()`\n    \n* `WeakSet`\n\n    * `WeakSet.prototype.add()`\n    * `WeakSet.prototype.delete()`\n    * `WeakSet.prototype.has()`\n    * `WeakSet.prototype[@@toStringTag]()`\n\n## Contributing\n\nYour PRs and stars are always welcome.\n\nPlease, try to follow:\n\n* Clone the repository.\n* Checkout `develop` branch.\n* Install dependencies.\n* Add your new features or fixes.\n* Build the project.\n\n```sh\n$ git clone https://github.com/rousan/collections-es6.git\n$ cd collections-es6\n$ git checkout develop\n$ npm i\n$ npm run build\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frousan%2Fcollections-es6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frousan%2Fcollections-es6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frousan%2Fcollections-es6/lists"}