(function(root) {
Underscore-contrib (underscore.object.selectors.js 0.0.1) (c) 2013 Michael Fogus, DocumentCloud and Investigative Reporters & Editors Underscore-contrib may be freely distributed under the MIT license.
(function(root) {
Establish the root object, window
in the browser, or global
on the server.
var _ = root._ || require('underscore');
Create quick reference variables for speed access to core prototypes.
var concat = Array.prototype.concat;
_.mixin({
Returns a function that will attempt to look up a named field in any object that it's given.
accessor: function(field) {
return function(obj) {
return (obj && obj[field]);
};
},
Like _.pick
except that it takes an array of keys to pick.
selectKeys: function (obj, ks) {
return _.pick.apply(null, concat.call([obj], ks));
}
});
})(this);