Browse Source

assert: name anonymous functions

Ref: https://github.com/nodejs/node/issues/8913
PR-URL: https://github.com/nodejs/node/pull/9051
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v7.x
Miguel Angel Asencio Hurtado 8 years ago
committed by James M Snell
parent
commit
1043f5d08e
  1. 9
      lib/assert.js

9
lib/assert.js

@ -359,13 +359,14 @@ function _throws(shouldThrow, block, expected, message) {
// 11. Expected to throw an error:
// assert.throws(block, Error_opt, message_opt);
assert.throws = function(block, /*optional*/error, /*optional*/message) {
assert.throws = function throws(block, /*optional*/error, /*optional*/message) {
_throws(true, block, error, message);
};
// EXTENSION! This is annoying to write outside this module.
assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
assert.doesNotThrow = doesNotThrow;
function doesNotThrow(block, /*optional*/error, /*optional*/message) {
_throws(false, block, error, message);
};
}
assert.ifError = function(err) { if (err) throw err; };
assert.ifError = function ifError(err) { if (err) throw err; };

Loading…
Cancel
Save