mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Remove _.at guard for _.map use.
This commit is contained in:
@@ -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('');
|
||||
}
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user