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 make_ in all collection methods #185
Conversation
- also use lang/isInteger in collection/size and collection/make_ to avoid using array iterators on array-like objects with NaN values - removed avoidable slice call in make_ - all relevant unit tests were updated - some objects in unit tests were changed to use string values rather than numeric values: this is due to a shortcoming of jasmine's toEqual() which asserts true for {0: 1} and [1].
In terms of array-like detecting I've started favoring one that aligns more with ES6: // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
var maxSafeInteger = Math.pow(2, 53) - 1;
// later...
typeof length == 'number' && length > -1 && length <= maxSafeInteger I find the inconsistency in collection methods confusing with some always returning arrays and others returning objects if you provide an object, some iterating over objects values providing keys and others iterating over object values providing indexes. Having /array methods specialized for arrays and returning arrays and having /object methods specialized objects and returns objects is great. Collections on the other hand are different. They put priority on array-like over plain object iteration and should return consistent types regardless of collection passed (array, arguments object, string, jquery object, plain object). Also array-like iteration should provide at least |
@mout/admin any feedback from you guys? I never use the collection methods, so unsure what would be the best behavior.. in fact I even considered killing the whole collections package a few times. |
I never used the |
Same here. I don't use them. But oddly enough a lot of times when I talk to people who use AMD structures in their projects but use lodash/underscore I tell them about mout. Usually their first feedback is: "I really like how I can use iterators like /cc @hapticdata |
I do really like how I can use iterators like from @jdalton
What in What methods are iterating over objects and providing indexes instead of keys? That does sound weird but I haven't seen it.
I completely agree with this, but again I don't see where that isn't happening? In the end I think letting users get on with their work is more important than the purity of separating objects from arrays. I'm already used to having this from underscore. As is implied by "modular utilities", if I don't want it, I won't use it. |
Many collections methods use
See collection/map. |
I see, you're right |
cdf5532
to
58cd272
Compare
fixes #183