Skip to content

Instantly share code, notes, and snippets.

@jarek-foksa
Created January 4, 2012 07:01
Show Gist options
  • Save jarek-foksa/1558886 to your computer and use it in GitHub Desktop.
Save jarek-foksa/1558886 to your computer and use it in GitHub Desktop.
Object.new = function(arg) {
var property;
var prototype = arg.__prototype__ || object;
var object = Object.create(prototype);
for (property in arg) {
if (arg.hasOwnProperty(property)) {
object[property] = arg[property];
}
}
object.makeNonEnumerable('__name__');
object.makeNonEnumerable('__prototype__');
return object;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment