diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 470a13a91..51c061825 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -317,9 +317,25 @@ module TestHead { result = _(list).head(); } -result = _.indexOf([1, 2, 3, 1, 2, 3], 2); -result = _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); -result = _.indexOf([1, 1, 2, 2, 3, 3], 2, true); +// _.indexOf +module TestIndexOf { + let array: TResult[]; + let list: _.List; + let value: TResult; + let result: number; + result = _.indexOf(array, value); + result = _.indexOf(array, value, true); + result = _.indexOf(array, value, 42); + result = _.indexOf(list, value); + result = _.indexOf(list, value, true); + result = _.indexOf(list, value, 42); + result = _(array).indexOf(value); + result = _(array).indexOf(value, true); + result = _(array).indexOf(value, 42); + result = _(list).indexOf(value); + result = _(list).indexOf(value, true); + result = _(list).indexOf(value, 42); +} //_.initial { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 918a24d35..d927303c7 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -762,60 +762,40 @@ declare module _ { //_.indexOf interface LoDashStatic { /** - * Gets the index at which the first occurrence of value is found using strict equality - * for comparisons, i.e. ===. If the array is already sorted providing true for fromIndex - * will run a faster binary search. - * @param array The array to search. - * @param value The value to search for. - * @param fromIndex The index to search from. - * @return The index of `value` within `array`. - **/ - indexOf( - array: Array, - value: T): number; - - /** - * @see _.indexOf - **/ - indexOf( - array: List, - value: T): number; - - /** - * @see _.indexOf - * @param fromIndex The index to search from - **/ - indexOf( - array: Array, - value: T, - fromIndex: number): number; - - /** - * @see _.indexOf - * @param fromIndex The index to search from - **/ + * Gets the index at which the first occurrence of value is found in array using SameValueZero for equality + * comparisons. If fromIndex is negative, it’s used as the offset from the end of array. If array is sorted + * providing true for fromIndex performs a faster binary search. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return The index to search from or true to perform a binary search on a sorted array. + */ indexOf( array: List, value: T, - fromIndex: number): number; + fromIndex?: boolean|number + ): number; + } + interface LoDashArrayWrapper { /** - * @see _.indexOf - * @param isSorted True to perform a binary search on a sorted array. - **/ - indexOf( - array: Array, + * @see _.indexOf + */ + indexOf( value: T, - isSorted: boolean): number; + fromIndex?: boolean|number + ): number; + } + interface LoDashObjectWrapper { /** - * @see _.indexOf - * @param isSorted True to perform a binary search on a sorted array. - **/ - indexOf( - array: List, - value: T, - isSorted: boolean): number; + * @see _.indexOf + */ + indexOf( + value: TValue, + fromIndex?: boolean|number + ): number; } //_.initial