Skip to content
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

added add/remove methods with emitting #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ianstormtaylor
Copy link
Contributor

a remove makes a lot of sense to me, in which case having the add alias is nicer imo. with push left for backwards compat.

and then i'd like to be able to listen to models being added/removed from collections.

@esundahl
Copy link

Any chance to get this merged?

@tj
Copy link
Member

tj commented Jun 29, 2013

there's https://github.com/component/collection/pull/1/files as well, need to look at this stuff again, this lib has been stagnating for a while :D

@matthewmueller
Copy link
Member

maybe take a look at https://github.com/matthewmueller/array. It was inspired by this lib / enumerable.

Has events and only difference between collection and array.js is that collection wraps array, while array.js uses array-like object (marginally slower, but more elegant api). ie:

// component/collection
var users = Collection([user1, user2])
var user = users.at(0)

// array.js
var users = array([user1, user2])
user = users[0]

@tj
Copy link
Member

tj commented Jul 1, 2013

im down with replacing this module with "array", but it would be nice if we could get whatever changes were necessary in https://github.com/MatthewMueller/array/blob/master/lib/enumerable.js back into component/enumerable

@matthewmueller
Copy link
Member

i think i made a few minor modifications, but the only big change is arr.at(i) => arr[i]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants