🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
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.0.3

4

CHANGELOG.md

@@ -0,1 +1,5 @@

1.0.3 / 2015-01-29
=================
* If @@toStringTag is not present, use the old-school Object#toString test.
1.0.2 / 2015-01-29

@@ -2,0 +6,0 @@ =================

9

index.js
'use strict';
var toStr = Number.prototype.toString;
var numToStr = Number.prototype.toString;
var tryNumberObject = function tryNumberObject(value) {
try {
toStr.call(value);
numToStr.call(value);
return true;

@@ -12,2 +12,5 @@ } catch (e) {

};
var toStr = Object.prototype.toString;
var numClass = '[object Number]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';

@@ -17,3 +20,3 @@ module.exports = function isNumberObject(value) {

if (typeof value !== 'object') { return false; }
return tryNumberObject(value);
return hasToStringTag ? tryNumberObject(value) : toStr.call(value) === numClass;
};
{
"name": "is-number-object",
"version": "1.0.2",
"version": "1.0.3",
"author": "Jordan Harband",

@@ -5,0 +5,0 @@ "description": "Is this value a JS Number object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.",