Skip to content

Commit 85aa870

Browse files
committed
lodash: changed _.without() method
1 parent e60b1fd commit 85aa870

File tree

2 files changed

+43
-13
lines changed

2 files changed

+43
-13
lines changed

lodash/lodash-tests.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,28 @@ result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').v
456456
result = _(testUnzipWithList).unzipWith<number, TResult>(testUnzipWithIterator, any).value();
457457
}
458458

459-
result = <number[]>_.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
459+
// _.without
460+
{
461+
let testWithoutArray: number[];
462+
let testWithoutList: _.List<number>;
463+
let result: number[];
464+
result = _.without<number>(testWithoutArray);
465+
result = _.without<number>(testWithoutArray, 1);
466+
result = _.without<number>(testWithoutArray, 1, 2);
467+
result = _.without<number>(testWithoutArray, 1, 2, 3);
468+
result = _.without<number>(testWithoutList);
469+
result = _.without<number>(testWithoutList, 1);
470+
result = _.without<number>(testWithoutList, 1, 2);
471+
result = _.without<number>(testWithoutList, 1, 2, 3);
472+
result = _(testWithoutArray).without().value();
473+
result = _(testWithoutArray).without(1).value();
474+
result = _(testWithoutArray).without(1, 2).value();
475+
result = _(testWithoutArray).without(1, 2, 3).value();
476+
result = _(testWithoutList).without<number>().value();
477+
result = _(testWithoutList).without<number>(1).value();
478+
result = _(testWithoutList).without<number>(1, 2).value();
479+
result = _(testWithoutList).without<number>(1, 2, 3).value();
480+
}
460481

461482
// _.xor
462483
var testXorArray: number[];

lodash/lodash.d.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,21 +1831,30 @@ declare module _ {
18311831
//_.without
18321832
interface LoDashStatic {
18331833
/**
1834-
* Creates an array excluding all provided values using strict equality for comparisons, i.e. ===.
1835-
* @param array The array to filter.
1836-
* @param values The value(s) to exclude.
1837-
* @return A new array of filtered values.
1838-
**/
1834+
* Creates an array excluding all provided values using SameValueZero for equality comparisons.
1835+
*
1836+
* @param array The array to filter.
1837+
* @param values The values to exclude.
1838+
* @return Returns the new array of filtered values.
1839+
*/
18391840
without<T>(
1840-
array: Array<T>,
1841-
...values: T[]): T[];
1841+
array: T[]|List<T>,
1842+
...values: T[]
1843+
): T[];
1844+
}
1845+
1846+
interface LoDashArrayWrapper<T> {
1847+
/**
1848+
* @see _.without
1849+
*/
1850+
without(...values: T[]): LoDashArrayWrapper<T>;
1851+
}
18421852

1853+
interface LoDashObjectWrapper<T> {
18431854
/**
1844-
* @see _.without
1845-
**/
1846-
without<T>(
1847-
array: List<T>,
1848-
...values: T[]): T[];
1855+
* @see _.without
1856+
*/
1857+
without<TValue>(...values: TValue[]): LoDashArrayWrapper<TValue>;
18491858
}
18501859

18511860
//_.xor

0 commit comments

Comments
 (0)