Joined October 2013
·

Chris Coniglio

Oakland, CA
·
·

Posted to Object.extend Black Magic over 1 year ago

Hey @oronm, this is a very different type of functionality than underscore's extend. The extend in underscore simply copies properties from one object to another. This is creating a new object in which the prototype chain extends from the object on which the method was called, includes each argument passed, and ends with the new object.

Nice post! Wasn't aware of this functionality. I've always done it the other way around, i,.e. a script that does the stuff I want then calls git commands.

@dtao lol yeah I noticed that! Damn you markdown! Also, if we're going for performance. getters/setters aren't really the way to go yet. But, just throwing it out there as yet another alternative.

Object.defineProperty(ValueObject.prototype, "value", {
get: function () {return this.superValue},
set: function (v) (this.superValue = v;)
});

EDIT: No underscores....stupid markdown

Achievements
307 Karma
12,479 Total ProTip Views