🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

checktype

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

checktype - npm Package Compare versions

Comparing version

to
0.0.3

23

index.js

@@ -24,3 +24,5 @@ /*

Number.isInteger = function isInteger (nVal) {
return typeof nVal === "number" && isFinite(nVal) && nVal > -9007199254740992 && nVal < 9007199254740992 && Math.floor(nVal) === nVal;
return typeof nVal === "number" && isFinite(nVal)
&& nVal > -9007199254740992 && nVal < 9007199254740992
&& Math.floor(nVal) === nVal;
};

@@ -30,2 +32,9 @@ }

function ChecktypeError(key, type, object)
{
return SyntaxError(key + ' param should be a ' + (type.name || type)
+ ', not ' + value.constructor.name);
}
//

@@ -38,3 +47,3 @@ // Basic types

if(!(value instanceof Array))
throw SyntaxError(key+' param should be an Array of '+type+', not '+typeof value);
throw ChecktypeError(key, 'Array of '+type, value);

@@ -48,3 +57,3 @@ for(var i=0, item; item=value[i]; i++)

if(typeof value != 'boolean')
throw SyntaxError(key+' param should be a Boolean, not '+typeof value);
throw ChecktypeError(key, Boolean, value);
};

@@ -55,3 +64,3 @@

if(typeof value != 'number')
throw SyntaxError(key+' param should be a Number, not '+typeof value);
throw ChecktypeError(key, Number, value);
};

@@ -62,3 +71,3 @@

if(!Number.isInteger(value))
throw SyntaxError(key+' param should be an Integer, not '+typeof value);
throw ChecktypeError(key, Integer, value);
};

@@ -69,3 +78,3 @@

if(typeof value != 'object')
throw SyntaxError(key+' param should be an Object, not '+typeof value);
throw ChecktypeError(key, Object, value);
};

@@ -76,3 +85,3 @@

if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
throw ChecktypeError(key, String, value);
};

@@ -79,0 +88,0 @@

{
"name": "checktype",
"version": "0.0.2",
"version": "0.0.3",
"description": "Check the type of variables and parametes, also user defined",

@@ -5,0 +5,0 @@ "main": "index.js",