typeof-arguments
Advanced tools
Comparing version 3.1.1 to 3.1.2
14
index.js
@@ -10,9 +10,9 @@ /* global Function */ | ||
validateArguments(getArgumentsObject,getExpectedArray); | ||
Object.keys(getExpectedArray).forEach((item)=>{ | ||
if(!ofType(getArgumentsObject[item],getExpectedArray[item])){ | ||
var actual = getActualType(getArgumentsObject[item]); | ||
var types = getExpectedTypes(getExpectedArray[item]); | ||
var message = `Invalid argument [${item}]. The [${actual}] ${types.truthness}argument has been passed, while the ${types.message} is expected.`; | ||
for(var i=0;i<getExpectedArray.length;i++){ | ||
if(!ofType(getArgumentsObject[i],getExpectedArray[i])){ | ||
var actual = getActualType(getArgumentsObject[i]); | ||
var types = getExpectedTypes(getExpectedArray[i]); | ||
var message = `Invalid argument [${i}]. The [${actual}] ${types.truthness}argument has been passed, while the ${types.message} is expected.`; | ||
if(clb){ | ||
callbackFunction({actual:actual,expected:types.expected,message:message,index:Number(item)}); | ||
callbackFunction({actual:actual,expected:types.expected,message:message,index:Number(i)}); | ||
return false; | ||
@@ -24,3 +24,3 @@ } else { | ||
} | ||
}); | ||
} | ||
return true; | ||
@@ -27,0 +27,0 @@ }; |
{ | ||
"name": "typeof-arguments", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Validate the types of arguments passed to the function.", | ||
@@ -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
30399