diff --git a/lodash.js b/lodash.js index 13bfc5a9e..a6c6769cd 100644 --- a/lodash.js +++ b/lodash.js @@ -4512,6 +4512,13 @@ */ function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { switch (tag) { + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + case boolTag: case dateTag: // Coerce dates and booleans to numbers, dates to milliseconds and booleans diff --git a/test/test.js b/test/test.js index 8a166bb04..d6522bbe4 100644 --- a/test/test.js +++ b/test/test.js @@ -8024,6 +8024,25 @@ assert.strictEqual(_.isEqual(new Foo, args), false); }); + QUnit.test('should compare array buffers', function(assert) { + assert.expect(2); + + if (ArrayBuffer) { + var buffer1 = new ArrayBuffer(4), + buffer2 = new ArrayBuffer(8); + + assert.strictEqual(_.isEqual(buffer1, buffer2), false); + + buffer1 = new Int8Array([-1]).buffer; + buffer2 = new Uint8Array([255]).buffer; + + assert.strictEqual(_.isEqual(buffer1, buffer2), true); + } + else { + skipTest(assert, 2); + } + }); + QUnit.test('should compare date objects', function(assert) { assert.expect(4);