-
-
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
Collection & Model Mixin #4024
Collection & Model Mixin #4024
Conversation
Hm? You seem to have it already. |
Does it? I just assumed it wouldn't get transformed to a |
], function(config) { | ||
var Base = config[0], | ||
methods = config[1], | ||
attribute = config[2]; |
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.
Curious to know why you've used an array of array here instead of an array of object here, e.g:
_.each([
{base:Collection, methods: collectionMethods, attribute: 'models'},
{base:Model, methods: modelMethods, attribute: 'attributes'}
], function(config) {
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.
No real reason, I don't see a major advantage for either strategy at the moment. Though current impl it lends itself nicely to _.spread
if underscore ever decides to follow suit
Oh, didn't read that case. What fails if we use |
I think |
how has this not been merged yet? |
@rafde maybe you can take a look at backbone-metal, i think its something similar |
this PR is suppose to allow you to define your own functions that would proxy against
|
Combine implementation of collection and model underscore methods
Can I get another set of 👀 on this? Want to get it into #4028 |
Fine by me 👍 |
Adds Collection & Model mixins for adding custom implementations of iterator/check methods to base collection and model. The main motivation of this is to add some
lodash
methods that were missing on the prototype.Ideally one could do
However, I don't have a good idea of how to support iteratees, so things like
collection.sum('value')
Thoughts? /cc @akre54 @jridgewell