| 1 |
var basePick = require('./_basePick'), |
| 2 |
flatRest = require('./_flatRest'); |
| 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 |
module.exports = pick; |