{"id":13825798,"url":"https://github.com/inspect-js/which-collection","last_synced_at":"2025-04-05T04:30:39.159Z","repository":{"id":55718358,"uuid":"221401607","full_name":"inspect-js/which-collection","owner":"inspect-js","description":"Which kind of Collection (Map, Set, WeakMap, WeakSet) is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.","archived":false,"fork":false,"pushed_at":"2024-03-10T22:08:01.000Z","size":66,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T17:48:20.464Z","etag":null,"topics":["collection","javascript","map","set","weakmap","weakset","which"],"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/inspect-js.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["ljharb"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":"npm/deep-equal","community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-11-13T07:47:13.000Z","updated_at":"2024-03-16T16:08:51.000Z","dependencies_parsed_at":"2024-03-10T23:24:12.824Z","dependency_job_id":"577ace01-9cc7-4511-88a2-74c1001d9cd8","html_url":"https://github.com/inspect-js/which-collection","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"7b3e922ca0f9f356c1cbf4701857d71b378eb7d7"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inspect-js%2Fwhich-collection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inspect-js%2Fwhich-collection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inspect-js%2Fwhich-collection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inspect-js%2Fwhich-collection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inspect-js","download_url":"https://codeload.github.com/inspect-js/which-collection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289382,"owners_count":20914463,"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":["collection","javascript","map","set","weakmap","weakset","which"],"created_at":"2024-08-04T09:01:27.260Z","updated_at":"2025-04-05T04:30:37.047Z","avatar_url":"https://github.com/inspect-js.png","language":"JavaScript","readme":"# which-collection \u003csup\u003e[![Version Badge][2]][1]\u003c/sup\u003e\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![dependency status][5]][6]\n[![dev dependency status][7]][8]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][11]][1]\n\nWhich kind of Collection (Map, Set, WeakMap, WeakSet) is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.\n\n## Example\n\n```js\nvar whichCollection = require('which-collection');\nvar assert = require('assert');\n\nassert.equal(false, whichCollection(undefined));\nassert.equal(false, whichCollection(null));\nassert.equal(false, whichCollection(false));\nassert.equal(false, whichCollection(true));\nassert.equal(false, whichCollection([]));\nassert.equal(false, whichCollection({}));\nassert.equal(false, whichCollection(/a/g));\nassert.equal(false, whichCollection(new RegExp('a', 'g')));\nassert.equal(false, whichCollection(new Date()));\nassert.equal(false, whichCollection(42));\nassert.equal(false, whichCollection(NaN));\nassert.equal(false, whichCollection(Infinity));\nassert.equal(false, whichCollection(new Number(42)));\nassert.equal(false, whichCollection(42n));\nassert.equal(false, whichCollection(Object(42n)));\nassert.equal(false, whichCollection('foo'));\nassert.equal(false, whichCollection(Object('foo')));\nassert.equal(false, whichCollection(function () {}));\nassert.equal(false, whichCollection(function* () {}));\nassert.equal(false, whichCollection(x =\u003e x * x));\nassert.equal(false, whichCollection([]));\n\nassert.equal('Map', whichCollection(new Map()));\nassert.equal('Set', whichCollection(new Set()));\nassert.equal('WeakMap', whichCollection(new WeakMap()));\nassert.equal('WeakSet', whichCollection(new WeakSet()));\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[1]: https://npmjs.org/package/which-collection\n[2]: https://versionbadg.es/inspect-js/which-collection.svg\n[5]: https://david-dm.org/inspect-js/which-collection.svg\n[6]: https://david-dm.org/inspect-js/which-collection\n[7]: https://david-dm.org/inspect-js/which-collection/dev-status.svg\n[8]: https://david-dm.org/inspect-js/which-collection#info=devDependencies\n[11]: https://nodei.co/npm/which-collection.png?downloads=true\u0026stars=true\n[license-image]: https://img.shields.io/npm/l/which-collection.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/which-collection.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=which-collection\n[codecov-image]: https://codecov.io/gh/inspect-js/which-collection/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/inspect-js/which-collection/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/which-collection\n[actions-url]: https://github.com/inspect-js/which-collection/actions\n","funding_links":["https://github.com/sponsors/ljharb","https://tidelift.com/funding/github/npm/deep-equal"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finspect-js%2Fwhich-collection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finspect-js%2Fwhich-collection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finspect-js%2Fwhich-collection/lists"}