'use strict';
// UTILITY
+const compare = process.binding('buffer').compare;
const util = require('util');
const pSlice = Array.prototype.slice;
if (actual === expected) {
return true;
} else if (actual instanceof Buffer && expected instanceof Buffer) {
- if (actual.length != expected.length) return false;
-
- for (var i = 0; i < actual.length; i++) {
- if (actual[i] !== expected[i]) return false;
- }
-
- return true;
+ return compare(actual, expected) === 0;
// 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.