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

Pick for selecting part of object attributes #38

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@santervo

santervo commented Mar 26, 2013

Hey Hay

I've been using Stapes as a view model layer for Rivets.js, and Backbone as persistence layer.

In the view model layer I have both data that is going to be persisted (form data) and transient view attributes (such as whether todo entry is editable or not).

I've been missing a function similar to .pick in Underscore and Backbone to select only persistable attributes.

module.set({
  title: "Wash dishes",
  completed: true,
  editable: true
});

var persistableAttrs = module.pick('title', 'completed');
// { title: "Wash dishes", completed: true }

If you care to include this to Stapes, you'll find tests, documentation and implementation with this pull request.

hay added a commit that referenced this pull request Nov 6, 2013

@hay

This comment has been minimized.

Show comment
Hide comment
@hay

hay Nov 6, 2013

Owner

Thanks for the PR! I like the functionality and i have included it in commit 60c0799, however it's not a new method but part of the existing get method.

Owner

hay commented Nov 6, 2013

Thanks for the PR! I like the functionality and i have included it in commit 60c0799, however it's not a new method but part of the existing get method.

@hay hay closed this Nov 6, 2013

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