Remove _.at guard for _.map use.

This commit is contained in:
John-David Dalton
2014-05-03 21:42:19 -07:00
parent c19f87134e
commit 695d6e14d4
2 changed files with 2 additions and 14 deletions

View File

@@ -3610,17 +3610,12 @@
* _.at(['fred', 'barney', 'pebbles'], 0, 2);
* // => ['fred', 'pebbles']
*/
function at(collection, guard) {
function at(collection) {
var args = arguments,
index = -1,
props = baseFlatten(args, true, false, 1),
length = props.length,
type = typeof guard;
length = props.length;
// enables use as a callback for functions like `_.map`
if ((type == 'number' || type == 'string') && args[2] && args[2][guard] === collection) {
length = 1;
}
if (support.unindexedChars && isString(collection)) {
collection = collection.split('');
}

View File

@@ -693,13 +693,6 @@
deepEqual(actual, [1, 3]);
});
test('should work when used as a callback for `_.map`', 1, function() {
var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
actual = _.map(array, _.at);
deepEqual(actual, [[1], [5], [9]]);
});
_.each({
'literal': 'abc',
'object': Object('abc')