mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-02 12:00:51 +08:00
lodash: changed _.intersection() method
This commit is contained in:
+12
-1
@@ -290,7 +290,18 @@ result = <number[]>_.initial([1, 2, 3], function (num) {
|
||||
result = <IFoodOrganic[]>_.initial(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.initial(foodsType, { 'type': 'vegetable' });
|
||||
|
||||
result = <number[]>_.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||
// _.intersection
|
||||
{
|
||||
let testIntersectionArray: TResult[];
|
||||
let testIntersectionList: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.intersection<TResult>(testIntersectionArray, testIntersectionList);
|
||||
result = _.intersection<TResult>(testIntersectionList, testIntersectionArray, testIntersectionList);
|
||||
result = _(testIntersectionArray).intersection<TResult>(testIntersectionArray).value();
|
||||
result = _(testIntersectionArray).intersection<TResult>(testIntersectionList, testIntersectionArray).value();
|
||||
result = _(testIntersectionList).intersection<TResult>(testIntersectionArray).value();
|
||||
result = _(testIntersectionList).intersection<TResult>(testIntersectionList, testIntersectionArray).value();
|
||||
}
|
||||
|
||||
result = <number>_.last([1, 2, 3]);
|
||||
result = <number>_([1, 2, 3]).last();
|
||||
|
||||
Vendored
+19
-9
@@ -1028,17 +1028,27 @@ declare module _ {
|
||||
//_.intersection
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates an array of unique values present in all provided arrays using strict
|
||||
* equality for comparisons, i.e. ===.
|
||||
* @param arrays The arrays to inspect.
|
||||
* @return Returns an array of composite values.
|
||||
**/
|
||||
intersection<T>(...arrays: Array<T>[]): T[];
|
||||
* Creates an array of unique values that are included in all of the provided arrays using SameValueZero for
|
||||
* equality comparisons.
|
||||
*
|
||||
* @param arrays The arrays to inspect.
|
||||
* @return Returns the new array of shared values.
|
||||
*/
|
||||
intersection<T>(...arrays: (T[]|List<T>)[]): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.intersection
|
||||
**/
|
||||
intersection<T>(...arrays: List<T>[]): T[];
|
||||
* @see _.intersection
|
||||
*/
|
||||
intersection<TResult>(...arrays: (TResult[]|List<TResult>)[]): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.intersection
|
||||
*/
|
||||
intersection<TResult>(...arrays: (TResult[]|List<TResult>)[]): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.last
|
||||
|
||||
Reference in New Issue
Block a user