main export is an alias to assert.ok (like node core)
add ability to check arrayOfBuffer
fix bugs in arrayOfDate, arrayOfRegexp, etc.
fix bug where NODE_NDEBUG was ignored
add tests
$ npm test
> assert-plus@0.1.5 test /Users/dave.eddy/dev/node-assert-plus
> for f in ./tests/*.js; do echo "$f"; node "$f" || exit 1; done
./tests/all.test.js
./tests/exports.test.js
./tests/ndebug.test.js
Currently (meaning in master and npm right now), arrayOf{Date,Regexp} are broken. They check typeof (...) each member, but Date objects and Regexps will be of type "object", so they fail this check. The change proposed in this pr will ensure that, for arrays, each member will be tested against module.exports[type] method for the given type.
In current master/npm
> a.arrayOfDate([new Date()])
AssertionError: date (date) is required
at Object.module.exports.(anonymous function) [as arrayOfDate] (/Users/dave.eddy/temp/node_modules/assert-plus/assert.js:205:17)
at repl:1:4
at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:203:10)
at Interface._line (readline.js:532:8)
at Interface._ttyWrite (readline.js:761:14)
at ReadStream.onkeypress (readline.js:100:10)
at ReadStream.emit (events.js:98:17)
> a.arrayOfRegexp([/foo/])
AssertionError: regexp (regexp) is required
at Object.module.exports.(anonymous function) [as arrayOfRegexp] (/Users/dave.eddy/temp/node_modules/assert-plus/assert.js:205:17)
at repl:1:4
at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:203:10)
at Interface._line (readline.js:532:8)
at Interface._ttyWrite (readline.js:761:14)
at ReadStream.onkeypress (readline.js:100:10)
at ReadStream.emit (events.js:98:17)
Also, NDEBUG doesn't work for some methods (like assert.buffer)... this change moves all NDEBUG logic to be done to the exported functions to ensure it works 100% of the time (tests added)
Currently (meaning in master and npm right now),
arrayOf{Date,Regexp}
are broken. They checktypeof (...)
each member, but Date objects and Regexps will be of type"object"
, so they fail this check. The change proposed in this pr will ensure that, for arrays, each member will be tested againstmodule.exports[type]
method for the given type.In current master/npm
Also, NDEBUG doesn't work for some methods (like
assert.buffer
)... this change moves all NDEBUG logic to be done to the exported functions to ensure it works 100% of the time (tests added)