mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
Merge pull request #5888 from chrootsu/lodash-without
lodash: changed _.without() method
This commit is contained in:
@@ -497,7 +497,28 @@ result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').v
|
||||
result = _(testUnzipWithList).unzipWith<number, TResult>(testUnzipWithIterator, any).value();
|
||||
}
|
||||
|
||||
result = <number[]>_.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
|
||||
// _.without
|
||||
{
|
||||
let testWithoutArray: number[];
|
||||
let testWithoutList: _.List<number>;
|
||||
let result: number[];
|
||||
result = _.without<number>(testWithoutArray);
|
||||
result = _.without<number>(testWithoutArray, 1);
|
||||
result = _.without<number>(testWithoutArray, 1, 2);
|
||||
result = _.without<number>(testWithoutArray, 1, 2, 3);
|
||||
result = _.without<number>(testWithoutList);
|
||||
result = _.without<number>(testWithoutList, 1);
|
||||
result = _.without<number>(testWithoutList, 1, 2);
|
||||
result = _.without<number>(testWithoutList, 1, 2, 3);
|
||||
result = _(testWithoutArray).without().value();
|
||||
result = _(testWithoutArray).without(1).value();
|
||||
result = _(testWithoutArray).without(1, 2).value();
|
||||
result = _(testWithoutArray).without(1, 2, 3).value();
|
||||
result = _(testWithoutList).without<number>().value();
|
||||
result = _(testWithoutList).without<number>(1).value();
|
||||
result = _(testWithoutList).without<number>(1, 2).value();
|
||||
result = _(testWithoutList).without<number>(1, 2, 3).value();
|
||||
}
|
||||
|
||||
// _.xor
|
||||
var testXorArray: number[];
|
||||
|
||||
33
lodash/lodash.d.ts
vendored
33
lodash/lodash.d.ts
vendored
@@ -1878,21 +1878,30 @@ declare module _ {
|
||||
//_.without
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates an array excluding all provided values using strict equality for comparisons, i.e. ===.
|
||||
* @param array The array to filter.
|
||||
* @param values The value(s) to exclude.
|
||||
* @return A new array of filtered values.
|
||||
**/
|
||||
* Creates an array excluding all provided values using SameValueZero for equality comparisons.
|
||||
*
|
||||
* @param array The array to filter.
|
||||
* @param values The values to exclude.
|
||||
* @return Returns the new array of filtered values.
|
||||
*/
|
||||
without<T>(
|
||||
array: Array<T>,
|
||||
...values: T[]): T[];
|
||||
array: T[]|List<T>,
|
||||
...values: T[]
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.without
|
||||
**/
|
||||
without<T>(
|
||||
array: List<T>,
|
||||
...values: T[]): T[];
|
||||
* @see _.without
|
||||
*/
|
||||
without(...values: T[]): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.without
|
||||
*/
|
||||
without<TValue>(...values: TValue[]): LoDashArrayWrapper<TValue>;
|
||||
}
|
||||
|
||||
//_.xor
|
||||
|
||||
Reference in New Issue
Block a user