Skip to content

Instantly share code, notes, and snippets.

@sharmaabhinav
Last active November 11, 2017 13:57
Show Gist options
  • Save sharmaabhinav/0b15c7b4a998a1de5e0230765262d053 to your computer and use it in GitHub Desktop.
Save sharmaabhinav/0b15c7b4a998a1de5e0230765262d053 to your computer and use it in GitHub Desktop.
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