Skip to content

Instantly share code, notes, and snippets.

@AMorgaut
Forked from roboticstone/object.create.js
Last active March 2, 2017 20:59
Show Gist options
  • Save AMorgaut/999bcd663d3895bfe3298a4e0835b8e1 to your computer and use it in GitHub Desktop.
Save AMorgaut/999bcd663d3895bfe3298a4e0835b8e1 to your computer and use it in GitHub Desktop.
// Object.create Partial Polyfill with minimum Support for second parameter
if (!Object.create) {
Object.create = function(o, props) {
function F() {}
F.prototype = o;
result = new F();
if (!props) return result;
for (var prop in props) {
if (!props.hasOwnProperty(prop)) continue;
result[prop] = props[prop].value;
}
return result;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment