-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use _.create in extend #3553
Use _.create in extend #3553
Conversation
Is it worth breaking backwards compatibility so soon for this? Not worth waiting until |
Just raising an issue, can sit on it. It shouldn't break backwards compat unless people are relying on old versions of underscore |
The extend vs assign (in create) is a midly breaking change. I think the common case, though, is simple objects. |
// if supplied. | ||
if (protoProps) _.extend(child.prototype, protoProps); | ||
// `parent`'s constructor function and add the prototype properties. | ||
child.prototype = _.create(parent.prototype, protoProps); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll also need to set child.prototype.constructor = child
.
Ping @megawac, want to rebase and add in the |
9804472
to
3c6fabb
Compare
Right, done |
LGTM. |
April's long enough. Let's do this. |
As mentioned here jashkenas/underscore#2074