Gathering detailed insights and metrics for which-boxed-primitive
Gathering detailed insights and metrics for which-boxed-primitive
Gathering detailed insights and metrics for which-boxed-primitive
Gathering detailed insights and metrics for which-boxed-primitive
Which kind of boxed JS primitive is this?
npm install which-boxed-primitive
Typescript
Module System
Min. Node Version
Node Version
NPM Version
98.6
Supply Chain
89.8
Quality
77.3
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
4,985,438,432
Last Day
2,125,815
Last Week
36,978,264
Last Month
159,159,583
Last Year
1,625,914,060
MIT License
7 Stars
56 Commits
2 Forks
3 Watchers
1 Branches
2 Contributors
Updated on Dec 16, 2024
Minified
Minified + Gzipped
Latest Version
1.1.1
Package Id
which-boxed-primitive@1.1.1
Unpacked Size
18.83 kB
Size
6.57 kB
File Count
12
NPM Version
10.9.2
Node Version
23.4.0
Published on
Dec 16, 2024
Cumulative downloads
Total Downloads
Last Day
-9.8%
2,125,815
Compared to previous day
Last Week
-7.6%
36,978,264
Compared to previous week
Last Month
-0.2%
159,159,583
Compared to previous month
Last Year
24.7%
1,625,914,060
Compared to previous year
Which kind of boxed JS primitive is this? This module works cross-realm/iframe, does not depend on instanceof
or mutable properties, and works despite ES6 Symbol.toStringTag.
1var whichBoxedPrimitive = require('which-boxed-primitive'); 2var assert = require('assert'); 3 4// unboxed primitives return `null` 5// boxed primitives return the builtin constructor name 6 7assert.equal(whichBoxedPrimitive(undefined), null); 8assert.equal(whichBoxedPrimitive(null), null); 9 10assert.equal(whichBoxedPrimitive(false), null); 11assert.equal(whichBoxedPrimitive(true), null); 12assert.equal(whichBoxedPrimitive(new Boolean(false)), 'Boolean'); 13assert.equal(whichBoxedPrimitive(new Boolean(true)), 'Boolean'); 14 15assert.equal(whichBoxedPrimitive(42), null); 16assert.equal(whichBoxedPrimitive(NaN), null); 17assert.equal(whichBoxedPrimitive(Infinity), null); 18assert.equal(whichBoxedPrimitive(new Number(42)), 'Number'); 19assert.equal(whichBoxedPrimitive(new Number(NaN)), 'Number'); 20assert.equal(whichBoxedPrimitive(new Number(Infinity)), 'Number'); 21 22assert.equal(whichBoxedPrimitive(''), null); 23assert.equal(whichBoxedPrimitive('foo'), null); 24assert.equal(whichBoxedPrimitive(new String('')), 'String'); 25assert.equal(whichBoxedPrimitive(new String('foo')), 'String'); 26 27assert.equal(whichBoxedPrimitive(Symbol()), null); 28assert.equal(whichBoxedPrimitive(Object(Symbol()), 'Symbol'); 29 30assert.equal(whichBoxedPrimitive(42n), null); 31assert.equal(whichBoxedPrimitive(Object(42n), 'BigInt'); 32 33// non-boxed-primitive objects return `undefined` 34assert.equal(whichBoxedPrimitive([]), undefined); 35assert.equal(whichBoxedPrimitive({}), undefined); 36assert.equal(whichBoxedPrimitive(/a/g), undefined); 37assert.equal(whichBoxedPrimitive(new RegExp('a', 'g')), undefined); 38assert.equal(whichBoxedPrimitive(new Date()), undefined); 39assert.equal(whichBoxedPrimitive(function () {}), undefined); 40assert.equal(whichBoxedPrimitive(function* () {}), undefined); 41assert.equal(whichBoxedPrimitive(x => x * x), undefined); 42assert.equal(whichBoxedPrimitive([]), undefined); 43
Simply clone the repo, npm install
, and run npm test
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
security policy file detected
Details
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More