Gathering detailed insights and metrics for which-builtin-type
Gathering detailed insights and metrics for which-builtin-type
Gathering detailed insights and metrics for which-builtin-type
Gathering detailed insights and metrics for which-builtin-type
What is the type of this builtin JS value?
npm install which-builtin-type
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
1,159,088,387
Last Day
1,330,311
Last Week
24,186,946
Last Month
103,108,329
Last Year
859,307,251
MIT License
3 Stars
71 Commits
1 Forks
4 Watchers
1 Branches
1 Contributors
Updated on Dec 13, 2024
Minified
Minified + Gzipped
Latest Version
1.2.1
Package Id
which-builtin-type@1.2.1
Unpacked Size
29.34 kB
Size
9.16 kB
File Count
10
NPM Version
10.9.2
Node Version
23.4.0
Published on
Dec 13, 2024
Cumulative downloads
Total Downloads
Last Day
-2.3%
1,330,311
Compared to previous day
Last Week
-6.3%
24,186,946
Compared to previous week
Last Month
-1.3%
103,108,329
Compared to previous month
Last Year
189.9%
859,307,251
Compared to previous year
13
34
What is the type of this builtin JavaScript value? Works cross-realm, without instanceof
, and can not be fooled by a constructor
property.
1var whichBuiltinType = require('which-builtin-type'); 2var assert = require('assert'); 3 4assert.equal(undefined, whichBuiltinType(undefined)); 5assert.equal(null, whichBuiltinType(null)); 6assert.equal('Boolean', whichBuiltinType(false)); 7assert.equal('Boolean', whichBuiltinType(true)); 8assert.equal('Array', whichBuiltinType([])); 9assert.equal('Object', whichBuiltinType({})); 10assert.equal('RegExp', whichBuiltinType(/a/g)); 11assert.equal('RegExp', whichBuiltinType(new RegExp('a', 'g'))); 12assert.equal('Date', whichBuiltinType(new Date())); 13assert.equal('Number', whichBuiltinType(42)); 14assert.equal('Number', whichBuiltinType(NaN)); 15assert.equal('Number', whichBuiltinType(Infinity)); 16assert.equal('Number', whichBuiltinType(new Number(42))); 17assert.equal('String', whichBuiltinType('foo')); 18assert.equal('String', whichBuiltinType(Object('foo'))); 19assert.equal('Function', whichBuiltinType(function () {})); 20assert.equal('GeneratorFunction', whichBuiltinType(function* () {})); 21assert.equal('Function', whichBuiltinType(x => x * x)); 22assert.equal('Array', whichBuiltinType([])); 23assert.equal('Int8Array', whichBuiltinType(new Int8Array())); 24assert.equal('Uint8Array', whichBuiltinType(new Uint8Array())); 25assert.equal('Uint8ClampedArray', whichBuiltinType(new Uint8ClampedArray())); 26assert.equal('Int16Array', whichBuiltinType(new Int16Array())); 27assert.equal('Uint16Array', whichBuiltinType(new Uint16Array())); 28assert.equal('Int32Array', whichBuiltinType(new Int32Array())); 29assert.equal('Uint32Array', whichBuiltinType(new Uint32Array())); 30assert.equal('Float32Array', whichBuiltinType(new Float32Array())); 31assert.equal('Float64Array', whichBuiltinType(new Float64Array())); 32assert.equal('BigInt64Array', whichBuiltinType(new BigInt64Array())); 33assert.equal('BigUint64Array', whichBuiltinType(new BigUint64Array()));
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
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 0/30 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
no SAST tool detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-06-30
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