Ensure _.at can work as a callback for _.map and add similar unit tests for _.assign, _.defaults, _.merge, _.first, _.initial, _.last, and _.rest.

Former-commit-id: 92e71c6bae084029df3cc0e7af78af7ce7566be0
This commit is contained in:
John-David Dalton
2013-08-15 00:33:59 -07:00
parent 0669a053db
commit 161012b0a7
7 changed files with 140 additions and 95 deletions

View File

@@ -2951,9 +2951,10 @@
* // => ['moe', 'curly']
*/
function at(collection) {
var index = -1,
props = baseFlatten(arguments, true, false, 1),
length = props.length,
var args = arguments,
index = -1,
props = baseFlatten(args, true, false, 1),
length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length,
result = Array(length);
if (support.unindexedChars && isString(collection)) {