Browse Source

Special deepEquals for buffer

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
1be722a271
  1. 9
      lib/assert.js

9
lib/assert.js

@ -131,6 +131,15 @@ function _deepEqual(actual, expected) {
if (actual === expected) {
return true;
} else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
if (actual.length != expected.length) return false;
for (var i = 0; i < actual.length; i++) {
if (actual[i] !== expected[i]) return false;
}
return true;
// 7.2. If the expected value is a Date object, the actual value is
// equivalent if it is also a Date object that refers to the same time.
} else if (actual instanceof Date && expected instanceof Date) {

Loading…
Cancel
Save