Comparing version 2.1.0 to 2.1.1
12
index.js
@@ -18,3 +18,3 @@ module.exports = function(val,type){ | ||
if(vUnd||vNull) return false; | ||
return val.constructor.name === type.name; | ||
return Object.getPrototypeOf(val).constructor.name === type.name; | ||
} | ||
@@ -29,3 +29,3 @@ | ||
if(type[i]===null||typeof type[i]==='undefined') continue; | ||
if(val.constructor.name === type[i].name) return true; | ||
if(Object.getPrototypeOf(val).constructor.name === type[i].name) return true; | ||
} | ||
@@ -43,4 +43,4 @@ return false; | ||
if(vNull||val===undefined) return false; | ||
if((reg).test(val.toString())&&val.constructor.name==='Object'&&t.some((i)=>i==='arguments')) return true; | ||
return t.some((i)=>i===val.constructor.name.toLowerCase()); | ||
if((reg).test(val.toString())&&Object.getPrototypeOf(val).constructor.name==='Object'&&t.some((i)=>i==='arguments')) return true; | ||
return t.some((i)=>i===Object.getPrototypeOf(val).constructor.name.toLowerCase()); | ||
} | ||
@@ -55,6 +55,6 @@ | ||
if(vNull||val===undefined) return false; | ||
if(type.test('arguments')&&val.constructor.name==='Object'&&(reg).test(val.toString())) return true; | ||
return type.test(val.constructor.name); | ||
if(type.test('arguments')&&Object.getPrototypeOf(val).constructor.name==='Object'&&(reg).test(val.toString())) return true; | ||
return type.test(Object.getPrototypeOf(val).constructor.name); | ||
} | ||
return false; | ||
}; |
{ | ||
"name": "of-type", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Check if the given value is of the particular type or types.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
264791