
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
which-collection
Advanced tools
Which kind of Collection (Map, Set, WeakMap, WeakSet) is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.
Which kind of Collection (Map, Set, WeakMap, WeakSet) is this JavaScript value? Works cross-realm, without instanceof
, and despite Symbol.toStringTag.
var whichCollection = require('which-collection');
var assert = require('assert');
assert.equal(false, whichCollection(undefined));
assert.equal(false, whichCollection(null));
assert.equal(false, whichCollection(false));
assert.equal(false, whichCollection(true));
assert.equal(false, whichCollection([]));
assert.equal(false, whichCollection({}));
assert.equal(false, whichCollection(/a/g));
assert.equal(false, whichCollection(new RegExp('a', 'g')));
assert.equal(false, whichCollection(new Date()));
assert.equal(false, whichCollection(42));
assert.equal(false, whichCollection(NaN));
assert.equal(false, whichCollection(Infinity));
assert.equal(false, whichCollection(new Number(42)));
assert.equal(false, whichCollection(42n));
assert.equal(false, whichCollection(Object(42n)));
assert.equal(false, whichCollection('foo'));
assert.equal(false, whichCollection(Object('foo')));
assert.equal(false, whichCollection(function () {}));
assert.equal(false, whichCollection(function* () {}));
assert.equal(false, whichCollection(x => x * x));
assert.equal(false, whichCollection([]));
assert.equal('Map', whichCollection(new Map()));
assert.equal('Set', whichCollection(new Set()));
assert.equal('WeakMap', whichCollection(new WeakMap()));
assert.equal('WeakSet', whichCollection(new WeakSet()));
Simply clone the repo, npm install
, and run npm test
v1.0.2 - 2024-03-08
a5b2949
283ec03
bf576db
node/install
instead of node/run
; use codecov
action 24968a2
eslint
, @ljharb/eslint-config
, object-inspect
, safe-publish-latest
, tape
f60b277
nyc
on all tests 5700269
eslint
, @ljharb/eslint-config
, aud
, auto-changelog
, object-inspect
, tape
eb1f1a4
cd5b8fc
eslint
, @ljharb/eslint-config
, aud
, auto-changelog
, object-inspect
, tape
f5786fa
7ac7b67
b074105
eslint
, @ljharb/eslint-config
, aud
, auto-changelog
, object-inspect
, tape
ec640d6
65d842e
f106289
@ljharb/eslint-config
, aud
, npmignore
, object-inspect
, tape
e784a1f
npmignore
to autogenerate an npmignore file 95b503f
121ba2d
is-map
, is-set
, is-weakmap
, is-weakset
4aa150f
2afaed7
is-map
, is-set
ce44763
pull_request_target
event b16b664
auto-changelog
, tape
2b9c953
engines.node
dcdbfde
auto-changelog
; add aud
8e7f28d
sideEffects
flag 3e0376b
is-weakset
7b3e922
3339fea
FAQs
Which kind of Collection (Map, Set, WeakMap, WeakSet) is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.
The npm package which-collection receives a total of 23,274,088 weekly downloads. As such, which-collection popularity was classified as popular.
We found that which-collection demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.