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

Add findOne() convenience method on Container #1033

Merged
merged 1 commit into from Dec 13, 2014

Conversation

Projects
None yet
2 participants
@pronebird
Contributor

pronebird commented Oct 23, 2014

There are situations when you want to find a single node by name or id. I don't see any convenient way to do this in KineticJS since Container.find() always returns array. findOne convenience method can be found from DOM API to ORM libraries, so I believe KineticJS should have one too :)

I have added a Container.findOne() convenience method and a simple test. it returns a node or undefined.

Optimized implementation should of course break the find() loop after first match found.

lavrton added a commit that referenced this pull request Dec 13, 2014

Merge pull request #1033 from pronebird/master
Add findOne() convenience method on Container

@lavrton lavrton merged commit ab67dc9 into ericdrowell:master Dec 13, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment