Files
lodash/at.js
John-David Dalton 35cdf6513b Bump to v4.13.0.
2016-05-22 19:35:24 -07:00

27 lines
670 B
JavaScript

import baseAt from './_baseAt.js';
import baseFlatten from './_baseFlatten.js';
import rest from './rest.js';
/**
* Creates an array of values corresponding to `paths` of `object`.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {...(string|string[])} [paths] The property paths of elements to pick.
* @returns {Array} Returns the picked values.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
*
* _.at(object, ['a[0].b.c', 'a[1]']);
* // => [3, 4]
*/
var at = rest(function(object, paths) {
return baseAt(object, baseFlatten(paths, 1));
});
export default at;