main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
627 bytes
|
Line | |
---|
1 | import basePick from './_basePick.js';
|
---|
2 | import flatRest from './_flatRest.js';
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Creates an object composed of the picked `object` properties.
|
---|
6 | *
|
---|
7 | * @static
|
---|
8 | * @since 0.1.0
|
---|
9 | * @memberOf _
|
---|
10 | * @category Object
|
---|
11 | * @param {Object} object The source object.
|
---|
12 | * @param {...(string|string[])} [paths] The property paths to pick.
|
---|
13 | * @returns {Object} Returns the new object.
|
---|
14 | * @example
|
---|
15 | *
|
---|
16 | * var object = { 'a': 1, 'b': '2', 'c': 3 };
|
---|
17 | *
|
---|
18 | * _.pick(object, ['a', 'c']);
|
---|
19 | * // => { 'a': 1, 'c': 3 }
|
---|
20 | */
|
---|
21 | var pick = flatRest(function(object, paths) {
|
---|
22 | return object == null ? {} : basePick(object, paths);
|
---|
23 | });
|
---|
24 |
|
---|
25 | export default pick;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.