Add new helper methods to util\Collection #644

Closed
mgcrea opened this Issue Sep 17, 2012 · 1 comment

Comments

Projects
None yet
2 participants
Member

mgcrea commented Sep 17, 2012

It would be great if we had a couple of extra collection filtering/mapping method out of the box. It looks like overriding \lithium\util\Collection in a project would be quite complicated (I don't really see how to do it easily).

I'm thinking about ECMAScript5 functions like filter, any / some, include / contains, all / every : you can check them at : http://underscorejs.org/#collections

Regards.

Owner

nateabele commented Sep 18, 2012

I don't know that I really see a use case. Pretty much everything you can do with the methods presented can be done with the existing find() and first() methods, and a couple of comparison or casting operators, i.e. find/detect == (bool) $collection->find($filter), all/every == $collection->find($filter) == $collection, etc.

If you have specific examples of operations that cannot easily be accomplished with the above, please reopen this issue with an explanation and code for those examples. Thanks.

@nateabele nateabele closed this Sep 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment