avo-assert-js
Advanced tools
Comparing version 1.1.1 to 1.2.0
15
index.js
@@ -78,1 +78,16 @@ exports.assertString = function assertString(propName, str) { | ||
}; | ||
exports.assertList = function(propName, type, value) { | ||
if (!Array.isArray(value)) { | ||
console.warn( | ||
propName + ' should be of type list but you provided type ' + typeof value | ||
); | ||
} else { | ||
value.forEach((val, index) => | ||
exports[`assert${type.charAt(0).toUpperCase() + type.slice(1)}`]( | ||
`item at index ${index} in ${propName}`, | ||
val | ||
) | ||
); | ||
} | ||
}; |
{ | ||
"name": "avo-assert-js", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"main": "index.js", | ||
"license": "MIT" | ||
} |
2296
86