Installations
npm install which-builtin-type
Releases
Unable to fetch releases
Developer
inspect-js
Developer Guide
Module System
CommonJS, ESM
Min. Node Version
>= 0.4
Typescript Support
Yes
Node Version
23.2.0
NPM Version
10.9.0
Statistics
3 Stars
64 Commits
1 Forks
5 Watching
1 Branches
1 Contributors
Updated on 23 Nov 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
610,126,691
Last day
30.6%
3,360,899
Compared to previous day
Last week
33.8%
18,039,535
Compared to previous week
Last month
14.3%
62,191,388
Compared to previous month
Last year
628.7%
534,750,501
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
13
Dev Dependencies
37
which-builtin-type
What is the type of this builtin JavaScript value? Works cross-realm, without instanceof
, and can not be fooled by a constructor
property.
Example
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()));
Tests
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
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/inspect-js/.github/SECURITY.md:1
- Info: Found linked content: github.com/inspect-js/.github/SECURITY.md:1
- Warn: One or no descriptive hints of disclosure, vulnerability, and/or timelines in security policy
- Info: Found text in security policy: github.com/inspect-js/.github/SECURITY.md:1
Reason
8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/require-allow-edits.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/inspect-js/which-builtin-type/require-allow-edits.yml/main?enable=pin
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node-aught.yml:1
- Warn: no topLevel permission defined: .github/workflows/node-pretest.yml:1
- Info: topLevel 'contents' permission set to 'read': .github/workflows/node-tens.yml:6
- Info: topLevel 'contents' permission set to 'read': .github/workflows/node-twenties.yml:6
- Warn: no topLevel permission defined: .github/workflows/rebase.yml:1
- Warn: no topLevel permission defined: .github/workflows/require-allow-edits.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Score
5
/10
Last Scanned on 2024-11-25
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