diff options
Diffstat (limited to 'lib/assert.js')
-rw-r--r-- | lib/assert.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/assert.js b/lib/assert.js index a13cc50316..5cd75b220a 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -59,7 +59,7 @@ assert.AssertionError = function AssertionError(options) { util.inherits(assert.AssertionError, Error); function truncate(s, n) { - if (util.isString(s)) { + if (typeof s === 'string') { return s.length < n ? s : s.slice(0, n); } else { return s; @@ -138,8 +138,7 @@ function _deepEqual(actual, expected) { // 7.1. All identical values are equivalent, as determined by ===. if (actual === expected) { return true; - - } else if (util.isBuffer(actual) && util.isBuffer(expected)) { + } else if (actual instanceof Buffer && expected instanceof Buffer) { if (actual.length != expected.length) return false; for (var i = 0; i < actual.length; i++) { @@ -165,7 +164,8 @@ function _deepEqual(actual, expected) { // 7.4. Other pairs that do not both pass typeof value == 'object', // equivalence is determined by ==. - } else if (!util.isObject(actual) && !util.isObject(expected)) { + } else if ((actual === null || typeof actual !== 'object') && + (expected === null || typeof expected !== 'object')) { return actual == expected; // 7.5 For all other Object pairs, including Array objects, equivalence is @@ -184,7 +184,7 @@ function isArguments(object) { } function objEquiv(a, b) { - if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) + if (a === null || a === undefined || b === null || b === undefined) return false; // an identical 'prototype' property. if (a.prototype !== b.prototype) return false; @@ -270,11 +270,11 @@ function expectedException(actual, expected) { function _throws(shouldThrow, block, expected, message) { var actual; - if (!util.isFunction(block)) { + if (typeof block !== 'function') { throw new TypeError('block must be a function'); } - if (util.isString(expected)) { + if (typeof expected === 'string') { message = expected; expected = null; } |