Skip to content

Commit dfbb670

Browse files
committed
Support older browsers.
1 parent bbc050d commit dfbb670

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

lib/eql.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ catch(ex) {
2121
Buffer.isBuffer = function() { return false; }
2222
}
2323

24+
/*!
25+
* For browsers that don't support Object.getPrototypeOf (IE8?)
26+
*/
27+
28+
function _getProto(object) {
29+
if (typeof Object.getPrototypeOf === 'function') {
30+
return Object.getPrototypeOf(object);
31+
} else if (''.__proto__ === String.prototype) {
32+
return object.__proto__;
33+
} else {
34+
return object.constructor.prototype;
35+
}
36+
}
37+
2438
/*!
2539
* Primary Export
2640
*/
@@ -213,7 +227,7 @@ function objectEqual(a, b, m) {
213227
return false;
214228
}
215229

216-
if (Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) {
230+
if (_getProto(a) !== _getProto(b)) {
217231
return false;
218232
}
219233

0 commit comments

Comments
 (0)