mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
Special deepEquals for buffer
This commit is contained in:
parent
3c00ec4e48
commit
1be722a271
@ -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…
Reference in New Issue
Block a user