mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #5847 from chrootsu/lodash-pull
lodash: changed _.pull() method
This commit is contained in:
+28
-2
@@ -339,6 +339,34 @@ 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);
|
||||
|
||||
// _.pull
|
||||
{
|
||||
let testPullArray: TResult[];
|
||||
let testPullValue: TResult;
|
||||
let result: TResult[];
|
||||
result = _.pull<TResult>(testPullArray);
|
||||
result = _.pull<TResult>(testPullArray, testPullValue);
|
||||
result = _.pull<TResult>(testPullArray, testPullValue, testPullValue);
|
||||
result = _.pull<TResult>(testPullArray, testPullValue, testPullValue, testPullValue);
|
||||
result = _(testPullArray).pull().value();
|
||||
result = _(testPullArray).pull(testPullValue).value();
|
||||
result = _(testPullArray).pull(testPullValue, testPullValue).value();
|
||||
result = _(testPullArray).pull(testPullValue, testPullValue, testPullValue).value();
|
||||
}
|
||||
{
|
||||
let testPullList: _.List<TResult>;
|
||||
let testPullValue: TResult;
|
||||
let result: _.List<TResult>;
|
||||
result = _.pull<TResult>(testPullList);
|
||||
result = _.pull<TResult>(testPullList, testPullValue);
|
||||
result = _.pull<TResult>(testPullList, testPullValue, testPullValue);
|
||||
result = _.pull<TResult>(testPullList, testPullValue, testPullValue, testPullValue);
|
||||
result = _(testPullList).pull<TResult>().value();
|
||||
result = _(testPullList).pull<TResult>(testPullValue).value();
|
||||
result = _(testPullList).pull<TResult>(testPullValue, testPullValue).value();
|
||||
result = _(testPullList).pull<TResult>(testPullValue, testPullValue, testPullValue).value();
|
||||
}
|
||||
|
||||
// _.pullAt
|
||||
{
|
||||
let testPullAtArray: TResult[];
|
||||
@@ -371,8 +399,6 @@ result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]
|
||||
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[]>_.remove([1, 2, 3, 4, 5, 6], function (num: number) { return num % 2 == 0; });
|
||||
result = <IFoodOrganic[]>_.remove(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.remove(foodsType, { 'type': 'vegetable' });
|
||||
|
||||
Vendored
+29
-11
@@ -1052,22 +1052,40 @@ declare module _ {
|
||||
//_.pull
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Removes all provided values from the given array using strict equality for comparisons,
|
||||
* i.e. ===.
|
||||
* @param array The array to modify.
|
||||
* @param values The values to remove.
|
||||
* @return array.
|
||||
**/
|
||||
* Removes all provided values from array using SameValueZero for equality comparisons.
|
||||
*
|
||||
* Note: Unlike _.without, this method mutates array.
|
||||
*
|
||||
* @param array The array to modify.
|
||||
* @param values The values to remove.
|
||||
* @return Returns array.
|
||||
*/
|
||||
pull<T>(
|
||||
array: Array<T>,
|
||||
...values: T[]): T[];
|
||||
array: T[],
|
||||
...values: T[]
|
||||
): T[];
|
||||
|
||||
/**
|
||||
* @see _.pull
|
||||
**/
|
||||
* @see _.pull
|
||||
*/
|
||||
pull<T>(
|
||||
array: List<T>,
|
||||
...values: T[]): T[];
|
||||
...values: T[]
|
||||
): List<T>;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.pull
|
||||
*/
|
||||
pull(...values: T[]): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.pull
|
||||
*/
|
||||
pull<TValue>(...values: TValue[]): LoDashObjectWrapper<List<TValue>>;
|
||||
}
|
||||
|
||||
//_.pullAt
|
||||
|
||||
Reference in New Issue
Block a user