Last active
November 11, 2017 13:57
-
-
Save sharmaabhinav/0b15c7b4a998a1de5e0230765262d053 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isRelatedTo (o1, o2) { | |
function F() {} | |
F.prototype = o2 | |
return o1 instanceof F | |
} | |
if (!Object.create) { | |
Object.create = function(o) { | |
function F(){} | |
F.prototype = o; | |
return new F(); | |
} | |
} | |
if (!Object.is) { | |
Object.is = function(v1, v2) { | |
// test for `-0` | |
if (v1 === 0 && v2 === 0) { | |
return 1 / v1 === 1 / v2; | |
} | |
// test for `NaN` | |
if (v1 !== v1) { | |
return v2 !== v2; | |
} | |
// everything else | |
return v1 === v2; | |
}; | |
} | |
if (!Date.now) { | |
Date.now = function(){ | |
return (new Date()).getTime(); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment