assert-plus
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -28,2 +28,6 @@ // Copyright (c) 2012, Mark Cavage. All rights reserved. | ||
function uncapitalize(str) { | ||
return (str.charAt(0).toLowerCase() + str.slice(1)); | ||
} | ||
function _() { | ||
@@ -159,11 +163,21 @@ return (util.format.apply(util, arguments)); | ||
var _name = 'optional' + capitalize(k); | ||
if (k === 'bool') | ||
k = 'boolean'; | ||
if (k === 'func') | ||
k = 'function'; | ||
module.exports[_name] = function (arg, name) { | ||
if (!NDEBUG && arg !== undefined) { | ||
_assert(arg, k, name); | ||
} | ||
}; | ||
var s = uncapitalize(k.replace('arrayOf', '')); | ||
if (s === 'bool') | ||
s = 'boolean'; | ||
if (s === 'func') | ||
s = 'function'; | ||
if (k.indexOf('arrayOf') !== -1) { | ||
module.exports[_name] = function (arg, name) { | ||
if (!NDEBUG && arg !== undefined) { | ||
array(arg, s, name); | ||
} | ||
}; | ||
} else { | ||
module.exports[_name] = function (arg, name) { | ||
if (!NDEBUG && arg !== undefined) { | ||
_assert(arg, s, name); | ||
} | ||
}; | ||
} | ||
}); | ||
@@ -170,0 +184,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "Extra assertions on top of node's assert module", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "./assert.js", | ||
@@ -8,0 +8,0 @@ "dependencies": {}, |
@@ -1,2 +0,2 @@ | ||
# node-assert-extra | ||
# node-assert-plus | ||
@@ -3,0 +3,0 @@ This library is a super small wrapper over node's assert module that has two |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
9032
145
0