New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

is-number-object

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-number-object - npm Package Compare versions

Comparing version

to
1.1.0

index.d.ts

16

CHANGELOG.md

@@ -8,2 +8,18 @@ # Changelog

## [v1.1.0](https://github.com/inspect-js/is-number-object/compare/v1.0.7...v1.1.0) - 2024-12-01
### Commits
- [meta] use `npmignore` to autogenerate an npmignore file [`cb8423c`](https://github.com/inspect-js/is-number-object/commit/cb8423cd42bded7c9321e785a97c5305c2706b02)
- [New] add types [`273e406`](https://github.com/inspect-js/is-number-object/commit/273e4063e786210ce135237f1232630eecc22a88)
- [actions] split out node 10-20, and 20+ [`3da6267`](https://github.com/inspect-js/is-number-object/commit/3da6267437bbc8d8322abc231f6fbcdbdce1b9b4)
- [Robustness] use `call-bind` [`834c098`](https://github.com/inspect-js/is-number-object/commit/834c09801d923ddf638585a94020b7c3b3cec3dc)
- [actions] update rebase action to use reusable workflow [`84a8a9f`](https://github.com/inspect-js/is-number-object/commit/84a8a9f61b1e098cba7d2603d98c06fc96b60d60)
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `core-js`, `npmignore`, `tape` [`7275bca`](https://github.com/inspect-js/is-number-object/commit/7275bcad3910fe3073ca960fdb8018904f4eb5a0)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `core-js`, `tape` [`49a83aa`](https://github.com/inspect-js/is-number-object/commit/49a83aa830081afcbeae32adcd853f19202acc89)
- [Tests] replace `aud` with `npm audit` [`061492b`](https://github.com/inspect-js/is-number-object/commit/061492b782012e0d58714bdf8a1423910d6ea49a)
- [Refactor] avoid an expensive check, for null [`08d29a8`](https://github.com/inspect-js/is-number-object/commit/08d29a8442f5340eedc3817eddd8d1f4bfd02be2)
- [Deps] update `has-tostringtag` [`4e2ad65`](https://github.com/inspect-js/is-number-object/commit/4e2ad656b23fcfdc3fe8979c7865f501f49c4704)
- [Dev Deps] add missing peer dep [`8228bfa`](https://github.com/inspect-js/is-number-object/commit/8228bfa94317d0cd5a5e880991cb3c0f0c5e119b)
## [v1.0.7](https://github.com/inspect-js/is-number-object/compare/v1.0.6...v1.0.7) - 2022-04-01

@@ -10,0 +26,0 @@

15

index.js
'use strict';
var numToStr = Number.prototype.toString;
var callBound = require('call-bind/callBound');
var $numToStr = callBound('Number.prototype.toString');
/** @type {import('.')} */
var tryNumberObject = function tryNumberObject(value) {
try {
numToStr.call(value);
$numToStr(value);
return true;

@@ -12,6 +16,7 @@ } catch (e) {

};
var toStr = Object.prototype.toString;
var $toString = callBound('Object.prototype.toString');
var numClass = '[object Number]';
var hasToStringTag = require('has-tostringtag/shams')();
/** @type {import('.')} */
module.exports = function isNumberObject(value) {

@@ -21,6 +26,6 @@ if (typeof value === 'number') {

}
if (typeof value !== 'object') {
if (!value || typeof value !== 'object') {
return false;
}
return hasToStringTag ? tryNumberObject(value) : toStr.call(value) === numClass;
return hasToStringTag ? tryNumberObject(value) : $toString(value) === numClass;
};
{
"name": "is-number-object",
"version": "1.0.7",
"version": "1.1.0",
"author": "Jordan Harband <ljharb@gmail.com>",

@@ -11,2 +11,3 @@ "funding": {

"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublishOnly": "safe-publish-latest",

@@ -18,5 +19,6 @@ "prepublish": "not-in-publish || npm run prepublishOnly",

"test": "npm run tests-only && npm run test:corejs",
"posttest": "aud --production",
"posttest": "npx npm@'>=10.2' audit --production",
"prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
"lint": "eslint --ext=js,mjs .",
"postlint": "tsc -p . && attw -P",
"version": "auto-changelog && git add CHANGELOG.md",

@@ -41,33 +43,29 @@ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""

"homepage": "https://github.com/inspect-js/is-number-object#readme",
"dependencies": {
"call-bind": "^1.0.7",
"has-tostringtag": "^1.0.2"
},
"devDependencies": {
"@ljharb/eslint-config": "^20.2.3",
"aud": "^2.0.0",
"auto-changelog": "^2.4.0",
"core-js": "^3.21.1",
"@arethetypeswrong/cli": "^0.17.0",
"@ljharb/eslint-config": "^21.1.1",
"@ljharb/tsconfig": "^0.2.0",
"@types/call-bind": "^1.0.5",
"@types/core-js": "^2.5.8",
"@types/tape": "^5.6.5",
"auto-changelog": "^2.5.0",
"core-js": "^3.39.0",
"eclint": "^2.8.1",
"encoding": "^0.1.13",
"eslint": "=8.8.0",
"foreach": "^2.0.5",
"in-publish": "^2.0.1",
"indexof": "^0.0.1",
"is": "^3.3.0",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.5.2"
"tape": "^5.9.0",
"typescript": "next"
},
"testling": {
"files": "test/index.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
"files": "test/index.js"
},

@@ -85,5 +83,8 @@ "engines": {

},
"dependencies": {
"has-tostringtag": "^1.0.0"
"publishConfig": {
"ignore": [
".github/workflows",
"test-corejs.js"
]
}
}

@@ -8,2 +8,3 @@ 'use strict';

test('not Numbers', function (t) {
// @ts-expect-error
t.notOk(isNumber(), 'undefined is not Number');

@@ -24,2 +25,3 @@ t.notOk(isNumber(null), 'null is not Number');

test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
/** @type {{ toString(): string; valueOf(): number; [Symbol.toStringTag]?: string; }} */
var fakeNumber = {

@@ -26,0 +28,0 @@ toString: function () { return '7'; },