diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 633c4ed0d..1484ac048 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -371,6 +371,11 @@ result = _.include([1, 2, 3], 1, 2); result = _.include({ 'name': 'moe', 'age': 40 }, 'moe'); result = _.include('curly', 'ur'); +result = _.includes([1, 2, 3], 1); +result = _.includes([1, 2, 3], 1, 2); +result = _.includes({ 'name': 'moe', 'age': 40 }, 'moe'); +result = _.includes('curly', 'ur'); + result = <_.Dictionary>_.countBy([4.3, 6.1, 6.4], function (num) { return Math.floor(num); }); result = <_.Dictionary>_.countBy([4.3, 6.1, 6.4], function (num) { return this.floor(num); }, Math); result = <_.Dictionary>_.countBy(['one', 'two', 'three'], 'length'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9cb55485d..86e72e468 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2172,7 +2172,7 @@ declare module _ { ...indexes: number[]): T[]; } - //_.contains + //_.includes interface LoDashStatic { /** * Checks if a given value is present in a collection using strict equality for comparisons, @@ -2182,13 +2182,49 @@ declare module _ { * @param fromIndex The index to search from. * @return True if the target element is found, else false. **/ + includes( + collection: Array, + target: T, + fromIndex?: number): boolean; + + /** + * @see _.includes + **/ + includes( + collection: List, + target: T, + fromIndex?: number): boolean; + + /** + * @see _.includes + * @param dictionary The dictionary to iterate over. + * @param key The key in the dictionary to search for. + **/ + includes( + dictionary: Dictionary, + key: string, + fromIndex?: number): boolean; + + /** + * @see _.includes + * @param searchString the string to search + * @param targetString the string to search for + **/ + includes( + searchString: string, + targetString: string, + fromIndex?: number): boolean; + + /** + * @see _.includes + **/ contains( collection: Array, target: T, fromIndex?: number): boolean; /** - * @see _.contains + * @see _.includes **/ contains( collection: List, @@ -2196,7 +2232,7 @@ declare module _ { fromIndex?: number): boolean; /** - * @see _.contains + * @see _.includes * @param dictionary The dictionary to iterate over. * @param key The key in the dictionary to search for. **/ @@ -2206,7 +2242,7 @@ declare module _ { fromIndex?: number): boolean; /** - * @see _.contains + * @see _.includes * @param searchString the string to search * @param targetString the string to search for **/ @@ -2215,8 +2251,9 @@ declare module _ { targetString: string, fromIndex?: number): boolean; + /** - * @see _.contains + * @see _.includes **/ include( collection: Array, @@ -2224,7 +2261,7 @@ declare module _ { fromIndex?: number): boolean; /** - * @see _.contains + * @see _.includes **/ include( collection: List, @@ -2232,7 +2269,7 @@ declare module _ { fromIndex?: number): boolean; /** - * @see _.contains + * @see _.includes **/ include( dictionary: Dictionary, @@ -2240,7 +2277,7 @@ declare module _ { fromIndex?: number): boolean; /** - * @see _.contains + * @see _.includes **/ include( searchString: string,