1 var isArrayLike = require('./isArrayLike'),
2 isIndex = require('./isIndex');
5 * The base implementation of `_.at` without support for string collections
6 * and individual key arguments.
9 * @param {Array|Object} collection The collection to iterate over.
10 * @param {number[]|string[]} props The property names or indexes of elements to pick.
11 * @returns {Array} Returns the new array of picked elements.
13 function baseAt(collection, props) {
15 isNil = collection == null,
16 isArr = !isNil && isArrayLike(collection),
17 length = isArr ? collection.length : 0,
18 propsLength = props.length,
19 result = Array(propsLength);
21 while(++index < propsLength) {
22 var key = props[index];
24 result[index] = isIndex(key, length) ? collection[key] : undefined;
26 result[index] = isNil ? undefined : collection[key];
32 module.exports = baseAt;