~webapps/unity-js-scopes/node.js

« back to all changes in this revision

Viewing changes to tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/collection/at.js

  • Committer: Marcus Tomlinson
  • Date: 2015-11-13 07:59:04 UTC
  • Revision ID: marcus.tomlinson@canonical.com-20151113075904-h0swczmoq1rvstfc
Node v4 (stable)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
var baseAt = require('../internal/baseAt'),
 
2
    baseFlatten = require('../internal/baseFlatten'),
 
3
    restParam = require('../function/restParam');
 
4
 
 
5
/**
 
6
 * Creates an array of elements corresponding to the given keys, or indexes,
 
7
 * of `collection`. Keys may be specified as individual arguments or as arrays
 
8
 * of keys.
 
9
 *
 
10
 * @static
 
11
 * @memberOf _
 
12
 * @category Collection
 
13
 * @param {Array|Object|string} collection The collection to iterate over.
 
14
 * @param {...(number|number[]|string|string[])} [props] The property names
 
15
 *  or indexes of elements to pick, specified individually or in arrays.
 
16
 * @returns {Array} Returns the new array of picked elements.
 
17
 * @example
 
18
 *
 
19
 * _.at(['a', 'b', 'c'], [0, 2]);
 
20
 * // => ['a', 'c']
 
21
 *
 
22
 * _.at(['barney', 'fred', 'pebbles'], 0, 2);
 
23
 * // => ['barney', 'pebbles']
 
24
 */
 
25
var at = restParam(function(collection, props) {
 
26
  return baseAt(collection, baseFlatten(props));
 
27
});
 
28
 
 
29
module.exports = at;