Comparing version 1.0.4 to 1.1.0
@@ -8,2 +8,22 @@ # Changelog | ||
## [v1.1.0](https://github.com/inspect-js/is-bigint/compare/v1.0.4...v1.1.0) - 2024-12-02 | ||
### Commits | ||
- [actions] reuse common workflows [`0e63a44`](https://github.com/inspect-js/is-bigint/commit/0e63a44e5d1f26783bd5a40d7aa32c14b50fd567) | ||
- [meta] use `npmignore` to autogenerate an npmignore file [`47584ee`](https://github.com/inspect-js/is-bigint/commit/47584ee7ac726a5c7f5f2f5f34b97529134cf602) | ||
- [Tests] use `for-each` and `es-value-fixtures` [`f226864`](https://github.com/inspect-js/is-bigint/commit/f22686422b46334c64b3658fba1237751d24460c) | ||
- [New] add types [`78e2c47`](https://github.com/inspect-js/is-bigint/commit/78e2c473ff73d73eef27b7eb27695393667360e1) | ||
- [actions] split out node 10-20, and 20+ [`4395a8d`](https://github.com/inspect-js/is-bigint/commit/4395a8d340b1aa3c4e68b37092fcbcace14de41f) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `has-symbols`, `object-inspect`, `tape` [`c188501`](https://github.com/inspect-js/is-bigint/commit/c188501f67f4c220fcdf8d280c99e1f6af5d217e) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `safe-publish-latest`, `tape` [`5360d32`](https://github.com/inspect-js/is-bigint/commit/5360d32eee0e29f09b02d3adb51086dc71160939) | ||
- [actions] update rebase action to use reusable workflow [`d5c1775`](https://github.com/inspect-js/is-bigint/commit/d5c1775e437be97099a7e63b9bd68852b28e0ba7) | ||
- [actions] update codecov uploader [`c7478c7`](https://github.com/inspect-js/is-bigint/commit/c7478c74498ab954917bd6a561d0ee7d0ba60a6a) | ||
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `npmignore`, `object-inspect`, `tape` [`6fbce66`](https://github.com/inspect-js/is-bigint/commit/6fbce66ebab2ef471bfe841c8436eba3dce118c6) | ||
- [meta] add missing `engines.node` [`6f9ed42`](https://github.com/inspect-js/is-bigint/commit/6f9ed42ed8cb00b3fccdb62d4fcc8e7ab074e194) | ||
- [Tests] replace `aud` with `npm audit` [`21846c3`](https://github.com/inspect-js/is-bigint/commit/21846c305e5d662ec81b4922cbc57e9324ccd222) | ||
- [Dev Deps] remove unused `has-symbols`, add missing `has-tostringtag` [`b378d94`](https://github.com/inspect-js/is-bigint/commit/b378d942933ae97ab9610d83d69b52380d6a137c) | ||
- [Deps] update `has-bigints` [`f46c35b`](https://github.com/inspect-js/is-bigint/commit/f46c35be813c05549865477bd771300c2595496e) | ||
- [Dev Deps] add missing peer dep [`2b9be16`](https://github.com/inspect-js/is-bigint/commit/2b9be16ab6150d588f00d037b55050d8372953a3) | ||
## [v1.0.4](https://github.com/inspect-js/is-bigint/compare/v1.0.3...v1.0.4) - 2021-08-11 | ||
@@ -10,0 +30,0 @@ |
@@ -7,2 +7,3 @@ 'use strict'; | ||
var bigIntValueOf = BigInt.prototype.valueOf; | ||
/** @type {(value: object) => value is BigInt} */ | ||
var tryBigInt = function tryBigIntObject(value) { | ||
@@ -17,2 +18,3 @@ try { | ||
/** @type {import('.')} */ | ||
module.exports = function isBigInt(value) { | ||
@@ -37,2 +39,3 @@ if ( | ||
} else { | ||
/** @type {import('.')} */ | ||
module.exports = function isBigInt(value) { | ||
@@ -39,0 +42,0 @@ return false && value; |
{ | ||
"name": "is-bigint", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Is this value an ES BigInt?", | ||
"main": "index.js", | ||
"scripts": { | ||
"prepack": "npmignore --auto --commentLines=autogenerated", | ||
"prepublishOnly": "safe-publish-latest", | ||
"prepublish": "not-in-publish || npm run prepublishOnly", | ||
"lint": "eslint .", | ||
"postlint": "tsc -p . && attw -P", | ||
"pretest": "npm run lint", | ||
"tests-only": "nyc tape 'test/**/*.js'", | ||
"test": "npm run tests-only", | ||
"posttest": "aud --production", | ||
"posttest": "npx npm@'>=10.2' audit --production", | ||
"version": "auto-changelog && git add CHANGELOG.md", | ||
@@ -37,14 +39,24 @@ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" | ||
"dependencies": { | ||
"has-bigints": "^1.0.1" | ||
"has-bigints": "^1.0.2" | ||
}, | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^17.6.0", | ||
"aud": "^1.1.5", | ||
"auto-changelog": "^2.3.0", | ||
"eslint": "^7.32.0", | ||
"has-symbols": "^1.0.2", | ||
"@arethetypeswrong/cli": "^0.17.0", | ||
"@ljharb/eslint-config": "^21.1.1", | ||
"@ljharb/tsconfig": "^0.2.0", | ||
"@types/for-each": "^0.3.3", | ||
"@types/object-inspect": "^1.13.0", | ||
"@types/tape": "^5.6.5", | ||
"auto-changelog": "^2.5.0", | ||
"encoding": "^0.1.13", | ||
"es-value-fixtures": "^1.5.0", | ||
"eslint": "=8.8.0", | ||
"for-each": "^0.3.3", | ||
"has-tostringtag": "^1.0.2", | ||
"in-publish": "^2.0.1", | ||
"npmignore": "^0.3.1", | ||
"nyc": "^10.3.2", | ||
"object-inspect": "^1.11.0", | ||
"safe-publish-latest": "^1.1.4", | ||
"tape": "^5.3.1" | ||
"object-inspect": "^1.13.3", | ||
"safe-publish-latest": "^2.0.0", | ||
"tape": "^5.9.0", | ||
"typescript": "next" | ||
}, | ||
@@ -58,3 +70,11 @@ "auto-changelog": { | ||
"hideCredit": true | ||
}, | ||
"publishConfig": { | ||
"ignore": [ | ||
".github/workflows" | ||
] | ||
}, | ||
"engines": { | ||
"node": ">= 0.4" | ||
} | ||
} |
@@ -6,39 +6,25 @@ 'use strict'; | ||
var hasBigInts = require('has-bigints')(); | ||
var hasSymbols = require('has-symbols')(); | ||
var hasToStringTag = require('has-tostringtag/shams')(); | ||
var forEach = require('for-each'); | ||
var v = require('es-value-fixtures'); | ||
var isBigInt = require('../'); | ||
var debug = function (v, m) { return inspect(v) + ' ' + m; }; | ||
var forEach = function (arr, func) { | ||
var i; | ||
for (i = 0; i < arr.length; ++i) { | ||
func(arr[i], i, arr); | ||
} | ||
}; | ||
test('non-BigInt values', function (t) { | ||
var nonBigInts = [ | ||
true, | ||
false, | ||
/** @type {(typeof v.primitives[number] | object)[]} */ | ||
var nonBigInts = v.nonBigInts.concat( | ||
Object(true), | ||
Object(false), | ||
null, | ||
undefined, | ||
// @ts-expect-error TS sucks with concat | ||
{}, | ||
[], | ||
/a/g, | ||
'string', | ||
42, | ||
new Date(), | ||
function () {}, | ||
NaN | ||
]; | ||
if (hasSymbols) { | ||
nonBigInts.push(Symbol.iterator, Symbol('foo')); | ||
} | ||
NaN, | ||
v.symbols | ||
); | ||
t.plan(nonBigInts.length); | ||
forEach(nonBigInts, function (nonBigInt) { | ||
t.equal(false, isBigInt(nonBigInt), debug(nonBigInt, 'is not a BigInt')); | ||
t.equal(false, isBigInt(nonBigInt), inspect(nonBigInt) + ' is not a BigInt'); | ||
}); | ||
@@ -56,2 +42,3 @@ t.end(); | ||
t.test('faked @@toStringTag', { skip: !hasBigInts || !hasToStringTag }, function (st) { | ||
/** @type {{ valueOf(): unknown; [Symbol.toStringTag]?: unknown }} */ | ||
var fakeBigInt = { valueOf: function () { return BigInt(42); } }; | ||
@@ -61,2 +48,3 @@ fakeBigInt[Symbol.toStringTag] = 'BigInt'; | ||
/** @type {{ valueOf(): unknown; [Symbol.toStringTag]?: unknown }} */ | ||
var notSoFakeBigInt = { valueOf: function () { return 42; } }; | ||
@@ -75,8 +63,4 @@ notSoFakeBigInt[Symbol.toStringTag] = 'BigInt'; | ||
test('BigInt support', { skip: !hasBigInts }, function (t) { | ||
forEach([ | ||
Function('return 42n')(), // eslint-disable-line no-new-func | ||
BigInt(42), | ||
Object(BigInt(42)) | ||
], function (bigInt) { | ||
t.equal(true, isBigInt(bigInt), debug(bigInt, 'is a BigInt')); | ||
forEach(v.bigints.concat(Object(BigInt(42))), function (bigInt) { | ||
t.equal(true, isBigInt(bigInt), inspect(bigInt) + ' is a BigInt'); | ||
}); | ||
@@ -83,0 +67,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
17895
11
0
19
102
Updatedhas-bigints@^1.0.2