{"id":15757787,"url":"https://github.com/azu/map-like","last_synced_at":"2025-03-13T17:34:29.847Z","repository":{"id":65335732,"uuid":"56382868","full_name":"azu/map-like","owner":"azu","description":"ES2015 Map like object. Tiny `Map` shim.","archived":false,"fork":false,"pushed_at":"2020-07-09T16:03:11.000Z","size":87,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T20:23:13.924Z","etag":null,"topics":["ecmascript","javascript","map","polyfill"],"latest_commit_sha":null,"homepage":"","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/azu.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},"funding":{"github":"azu"}},"created_at":"2016-04-16T12:39:11.000Z","updated_at":"2023-03-31T20:13:54.000Z","dependencies_parsed_at":"2023-01-17T16:58:23.306Z","dependency_job_id":null,"html_url":"https://github.com/azu/map-like","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmap-like","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmap-like/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmap-like/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmap-like/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azu","download_url":"https://codeload.github.com/azu/map-like/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242900236,"owners_count":20203733,"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":["ecmascript","javascript","map","polyfill"],"created_at":"2024-10-04T09:40:26.258Z","updated_at":"2025-03-13T17:34:29.483Z","avatar_url":"https://github.com/azu.png","language":"JavaScript","funding_links":["https://github.com/sponsors/azu"],"categories":[],"sub_categories":[],"readme":"# map-like [![Actions Status: test](https://github.com/azu/map-like/workflows/test/badge.svg)](https://github.com/azu/map-like/actions?query=workflow%3A\"test\")\n\nECMAScript `Map` like class.\n\nIt has same API with [Map - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map \"Map - JavaScript | MDN\").\n\nThis library is tiny - 1.5kB(gzip).\n\n    ✈ bundle-size map-like\n    map-like@1.0.3\n\n    env  bundle   minify   gzip\n    --   5.73 kB  3.08 kB  1.5 kB\n\n## Limitation :warning:\n\n- Not support `Symbol.Iterator`\n  - This means that `MapLike` object is not iterable. \n- Return `Array` insteadof `Iterator` object.\n  - `MapLike#values()`, `MapLike#keys()`, `MapLike#entries()` return a `Array`.\n- Not support `toString()`\n\n## Why Map-**like**?\n\nI've created Map-like to avoid `Symbol.iterator`.\nBecause, the transpiled code of `Iterator` has a run-time cost at the current moment.\n\n- [Faster Collection Iterators | Benedikt Meurer](http://benediktmeurer.de/2017/07/14/faster-collection-iterators/ \"Faster Collection Iterators | Benedikt Meurer\")\n\nSo, `MapLike` does not support `Iterator` object.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n    npm install map-like\n\n## Usage\n\n```js\nconst { MapLike } = require(\"map-like\");\nconst map = new MapLike([\"key\", \"value\"]);\nconst value = map.get(\"key\");\nmap.set(\"newKey\", \"newValue\");\n```\n\n## API\n\n### `MapLike`\n\nES6 Map like object.\nSee [Map - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map \"Map - JavaScript | MDN\")\n\n#### `size`\n\nreturn map size\n\nReturns: **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**\n\n#### `entries(): Array`\n\nentries \\[[key, value], [key, value]] value\n\nReturns: **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)**\n\n#### `keys(): Array`\n\nget keys\n\nReturns: **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)**\n\n#### `values(): Array`\n\nget values\n\nReturns: **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)**\n\n#### `get(key: Any): Any`\n\n**Parameters**\n\n- `key`: **Any** - The key of the element to return from the Map object.\n\nReturns: **Any**\n\n#### `has(key: Any): boolean`\n\nhas value of key\n\n**Parameters**\n\n- `key`: **Any** - The key of the element to return from the Map object.\n\nReturns: **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**\n\n#### `set(key: Any, value: Any): MapLike`\n\nset value for key\n\n**Parameters**\n\n- `key`: **Any** - The key of the element to return from the Map object.\n- `value`: **Any**\n\nReturns: **MapLike**\n\n#### `delete(key: Any): boolean`\n\ndelete value for key\n\n**Parameters**\n\n- `key`: **Any** - The key of the element to return from the Map object.\n\nReturns: **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**\n\n#### `clear(): MapLike`\n\nclear defined key,value\n\nReturns: **MapLike**\n\n#### `forEach(handler: function (value, key, map), thisArg: [Any])`\n\nforEach map\n\n**Parameters**\n\n- `handler`: **function (value, key, [map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map))**\n- `thisArg`: **\\[Any]**\n\n## Changelog\n\nSee [Releases page](https://github.com/azu/map-like/releases).\n\n## Running tests\n\nInstall devDependencies and Run `npm test`:\n\n    npm i -d \u0026\u0026 npm test\n\n## Contributing\n\nPull requests and stars are always welcome.\nFor bugs and feature requests, [please create an issue](https://github.com/azu/map-like/issues).\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## Author\n\n- [github/azu](https://github.com/azu)\n- [twitter/azu_re](http://twitter.com/azu_re)\n\n## License\n\nMIT © azu\n\n## Thanks\n\nTest `MapLike` with test-case of \u003chttps://github.com/Financial-Times/polyfill-service/blob/master/polyfills/Map/tests.js\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fmap-like","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazu%2Fmap-like","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fmap-like/lists"}