mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-27 11:40:08 +08:00
lodash: changed _.pullAt() method
This commit is contained in:
+23
-1
@@ -298,6 +298,29 @@ result = <number>_([1, 2, 3]).last();
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
|
||||
// _.pullAt
|
||||
{
|
||||
let testPullAtArray: TResult[];
|
||||
let testPullAtList: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.pullAt<TResult>(testPullAtArray);
|
||||
result = _.pullAt<TResult>(testPullAtArray, 1);
|
||||
result = _.pullAt<TResult>(testPullAtArray, [2, 3], 1);
|
||||
result = _.pullAt<TResult>(testPullAtArray, 4, [2, 3], 1);
|
||||
result = _.pullAt<TResult>(testPullAtList);
|
||||
result = _.pullAt<TResult>(testPullAtList, 1);
|
||||
result = _.pullAt<TResult>(testPullAtList, [2, 3], 1);
|
||||
result = _.pullAt<TResult>(testPullAtList, 4, [2, 3], 1);
|
||||
result = _(testPullAtArray).pullAt().value();
|
||||
result = _(testPullAtArray).pullAt(1).value();
|
||||
result = _(testPullAtArray).pullAt([2, 3], 1).value();
|
||||
result = _(testPullAtArray).pullAt(4, [2, 3], 1).value();
|
||||
result = _(testPullAtList).pullAt<TResult>().value();
|
||||
result = _(testPullAtList).pullAt<TResult>(1).value();
|
||||
result = _(testPullAtList).pullAt<TResult>([2, 3], 1).value();
|
||||
result = _(testPullAtList).pullAt<TResult>(4, [2, 3], 1).value();
|
||||
}
|
||||
|
||||
result = <_.Dictionary<any>>_.zipObject(['moe', 'larry'], [30, 40]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_(['moe', 'larry']).zipObject([30, 40]);
|
||||
result = <_.Dictionary<any>>_.object(['moe', 'larry'], [30, 40]);
|
||||
@@ -308,7 +331,6 @@ result = <_.Dictionary<any>>_.object([['moe', 30], ['larry', 40]]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]]).object();
|
||||
|
||||
result = <number[]>_.pull([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
result = <number[]>_.pullAt([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
|
||||
result = <number[]>_.remove([1, 2, 3, 4, 5, 6], function (num: number) { return num % 2 == 0; });
|
||||
result = <IFoodOrganic[]>_.remove(foodsOrganic, 'organic');
|
||||
|
||||
Vendored
+25
-13
@@ -1104,24 +1104,36 @@ declare module _ {
|
||||
...values: T[]): T[];
|
||||
}
|
||||
|
||||
//_.pullAt
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Removes all provided values from the given array using strict equality for comparisons,
|
||||
* i.e. ===.
|
||||
* Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
|
||||
* Indexes may be specified as an array of indexes or as individual arguments.
|
||||
*
|
||||
* Note: Unlike _.at, this method mutates array.
|
||||
*
|
||||
* @param array The array to modify.
|
||||
* @param values The values to remove.
|
||||
* @return array.
|
||||
**/
|
||||
pullAt(
|
||||
array: Array<any>,
|
||||
...values: any[]): any[];
|
||||
* @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes.
|
||||
* @return Returns the new array of removed elements.
|
||||
*/
|
||||
pullAt<T>(
|
||||
array: T[]|List<T>,
|
||||
...indexes: (number|number[])[]
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.pull
|
||||
**/
|
||||
pullAt(
|
||||
array: List<any>,
|
||||
...values: any[]): any[];
|
||||
* @see _.pullAt
|
||||
*/
|
||||
pullAt(...indexes: (number|number[])[]): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.pullAt
|
||||
*/
|
||||
pullAt<TValue>(...indexes: (number|number[])[]): LoDashArrayWrapper<TValue>;
|
||||
}
|
||||
|
||||
//_.remove
|
||||
|
||||
Reference in New Issue
Block a user