diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c7feaf31b..e67f9827d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -366,16 +366,31 @@ result = _.contains([1, 2, 3], 1, 2); result = _.contains({ 'moe': 30, 'larry': 40, 'curly': 67 }, 40); result = _.contains('curly', 'ur'); +result = _([1, 2, 3]).contains(1); +result = _([1, 2, 3]).contains(1, 2); +result = _({ 'moe': 30, 'larry': 40, 'curly': 67 }).contains(40); +result = _('curly').contains('ur'); + result = _.include([1, 2, 3], 1); result = _.include([1, 2, 3], 1, 2); result = _.include({ 'moe': 30, 'larry': 40, 'curly': 67 }, 40); result = _.include('curly', 'ur'); +result = _([1, 2, 3]).include(1); +result = _([1, 2, 3]).include(1, 2); +result = _({ 'moe': 30, 'larry': 40, 'curly': 67 }).include(40); +result = _('curly').include('ur'); + result = _.includes([1, 2, 3], 1); result = _.includes([1, 2, 3], 1, 2); result = _.includes({ 'moe': 30, 'larry': 40, 'curly': 67 }, 40); result = _.includes('curly', 'ur'); +result = _([1, 2, 3]).includes(1); +result = _([1, 2, 3]).includes(1, 2); +result = _({ 'moe': 30, 'larry': 40, 'curly': 67 }).includes(40); +result = _('curly').includes('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 797c82b37..0b3aaf389 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -39,7 +39,7 @@ declare module _ { * Explicit chaining can be enabled by using the _.chain method. **/ (value: number): LoDashWrapper; - (value: string): LoDashWrapper; + (value: string): LoDashStringWrapper; (value: boolean): LoDashWrapper; (value: Array): LoDashNumberArrayWrapper; (value: Array): LoDashArrayWrapper; @@ -205,6 +205,8 @@ declare module _ { interface LoDashWrapper extends LoDashWrapperBase> { } + interface LoDashStringWrapper extends LoDashWrapper { } + interface LoDashObjectWrapper extends LoDashWrapperBase> { } interface LoDashArrayWrapper extends LoDashWrapperBase> { @@ -2164,6 +2166,57 @@ declare module _ { fromIndex?: number): boolean; } + interface LoDashArrayWrapper { + /** + * @see _.contains + **/ + contains(target: T, fromIndex?: number): boolean; + + /** + * @see _.contains + **/ + include(target: T, fromIndex?: number): boolean; + + /** + * @see _.contains + **/ + includes(target: T, fromIndex?: number): boolean; + } + + interface LoDashObjectWrapper { + /** + * @see _.contains + **/ + contains(target: TValue, fromIndex?: number): boolean; + + /** + * @see _.contains + **/ + include(target: TValue, fromIndex?: number): boolean; + + /** + * @see _.contains + **/ + includes(target: TValue, fromIndex?: number): boolean; + } + + interface LoDashStringWrapper { + /** + * @see _.contains + **/ + contains(target: string, fromIndex?: number): boolean; + + /** + * @see _.contains + **/ + include(target: string, fromIndex?: number): boolean; + + /** + * @see _.contains + **/ + includes(target: string, fromIndex?: number): boolean; + } + //_.countBy interface LoDashStatic { /**