object-pick
Advanced tools
Comparing version 0.1.0 to 0.1.1
# {%= name %} {%= badge("fury") %} | ||
> {%= description %} | ||
@@ -12,3 +11,2 @@ | ||
## Run tests | ||
@@ -15,0 +13,0 @@ |
@@ -15,3 +15,6 @@ /*! | ||
keys = Array.isArray(keys) ? keys : [keys]; | ||
if (typeof keys === 'string') { | ||
keys = [].slice.call(arguments, 1); | ||
} | ||
var len = keys.length; | ||
@@ -18,0 +21,0 @@ var o = {}; |
{ | ||
"name": "object-pick", | ||
"description": "Returns a filtered copy of an object with only the specified keys, exactly like `pick` from lo-dash / underscore.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/jonschlinkert/object-pick", | ||
@@ -6,0 +6,0 @@ "author": { |
# object-pick [![NPM version](https://badge.fury.io/js/object-pick.svg)](http://badge.fury.io/js/object-pick) | ||
> Returns a filtered copy of an object with only the specified keys, exactly like `pick` from lo-dash / underscore. | ||
@@ -17,3 +16,2 @@ | ||
## Run tests | ||
@@ -50,2 +48,2 @@ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 22, 2014._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 05, 2014._ |
@@ -14,7 +14,7 @@ /*! | ||
describe('.pick()', function () { | ||
it('should return an object with keys specified as strings.', function () { | ||
it('should pick keys specified as strings.', function () { | ||
pick({a: 'a', b: 'b'}, 'a').should.eql({a: 'a'}); | ||
}); | ||
it('should return an object with keys specified as arrays.', function () { | ||
it('should pick keys specified as arrays.', function () { | ||
pick({a: 'a', b: 'b', c: 'c'}, ['a', 'b']).should.eql({a: 'a', b: 'b'}); | ||
@@ -24,3 +24,3 @@ pick({foo: 'foo', bar: 'bar', baz: 'baz'}, ['foo', 'bar']).should.eql({foo: 'foo', bar: 'bar'}); | ||
it('should ignore keys that don not exist.', function () { | ||
it('should ignore keys that don\'t exist.', function () { | ||
pick({a: 'a', b: 'b', c: 'c'}, ['a', 'b', 'foo']).should.eql({a: 'a', b: 'b'}); | ||
@@ -27,0 +27,0 @@ pick({foo: 'foo', bar: 'bar', baz: 'baz'}, ['foo', 'bar', 'abc']).should.eql({foo: 'foo', bar: 'bar'}); |
46
6323
47