mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Cleanup wrapperAt.
This commit is contained in:
14
lodash.js
14
lodash.js
@@ -6882,7 +6882,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a wrapped array of values corresponding to `paths` of the wrapped object.
|
* This method is the wrapper version of `_.at`.
|
||||||
*
|
*
|
||||||
* @name at
|
* @name at
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -6894,10 +6894,10 @@
|
|||||||
*
|
*
|
||||||
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
||||||
*
|
*
|
||||||
* _(object).at(['a[0].b.c', 'a[1]']);
|
* _(object).at(['a[0].b.c', 'a[1]']).value();
|
||||||
* // => [3, 4]
|
* // => [3, 4]
|
||||||
*
|
*
|
||||||
* _(['a', 'b', 'c']).at(0, 2);
|
* _(['a', 'b', 'c']).at(0, 2).value();
|
||||||
* // => ['a', 'c']
|
* // => ['a', 'c']
|
||||||
*/
|
*/
|
||||||
var wrapperAt = rest(function(paths) {
|
var wrapperAt = rest(function(paths) {
|
||||||
@@ -6912,11 +6912,11 @@
|
|||||||
}
|
}
|
||||||
value = value.slice(start, +start + (length ? 1 : 0));
|
value = value.slice(start, +start + (length ? 1 : 0));
|
||||||
value.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
|
value.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
|
||||||
return new LodashWrapper(value, this.__chain__).thru(function(object) {
|
return new LodashWrapper(value, this.__chain__).thru(function(array) {
|
||||||
if (length && !object.length) {
|
if (length && !array.length) {
|
||||||
object.push(undefined);
|
array.push(undefined);
|
||||||
}
|
}
|
||||||
return object;
|
return array;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user