diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 63b0f39d8..a2184f6a9 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -291,13 +291,16 @@ 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); -result = _.initial([1, 2, 3]); -result = _.initial([1, 2, 3], 2); -result = _.initial([1, 2, 3], function (num) { - return num > 1; -}); -result = _.initial(foodsOrganic, 'organic'); -result = _.initial(foodsType, { 'type': 'vegetable' }); +//_.initial +{ + let testInitalArray: TResult[]; + let testInitalList: _.List; + let result: TResult[]; + result = _.initial(testInitalArray); + result = _.initial(testInitalList); + result = _(testInitalArray).initial().value(); + result = _(testInitalList).initial().value(); +} result = _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index cf6a1079a..50ba6ac96 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -963,92 +963,26 @@ declare module _ { //_.initial interface LoDashStatic { /** - * Gets all but the last element or last n elements of an array. If a callback is provided - * elements at the end of the array are excluded from the result as long as the callback - * returns truey. The callback is bound to thisArg and invoked with three arguments; - * (value, index, array). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param array The array to query. - * @param n Leaves this many elements behind, optional. - * @return Returns everything but the last `n` elements of `array`. - **/ - initial( - array: Array): T[]; + * Gets all but the last element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + initial(array: T[]|List): T[]; + } + interface LoDashArrayWrapper { /** - * @see _.initial - **/ - initial( - array: List): T[]; + * @see _.initial + */ + initial(): LoDashArrayWrapper; + } + interface LoDashObjectWrapper { /** - * @see _.initial - * @param n The number of elements to exclude. - **/ - initial( - array: Array, - n: number): T[]; - - /** - * @see _.initial - * @param n The number of elements to exclude. - **/ - initial( - array: List, - n: number): T[]; - - /** - * @see _.initial - * @param callback The function called per element - **/ - initial( - array: Array, - callback: ListIterator): T[]; - - /** - * @see _.initial - * @param callback The function called per element - **/ - initial( - array: List, - callback: ListIterator): T[]; - - /** - * @see _.initial - * @param pluckValue _.pluck style callback - **/ - initial( - array: Array, - pluckValue: string): T[]; - - /** - * @see _.initial - * @param pluckValue _.pluck style callback - **/ - initial( - array: List, - pluckValue: string): T[]; - - /** - * @see _.initial - * @param whereValue _.where style callback - **/ - initial( - array: Array, - whereValue: W): T[]; - - /** - * @see _.initial - * @param whereValue _.where style callback - **/ - initial( - array: List, - whereValue: W): T[]; + * @see _.initial + */ + initial(): LoDashArrayWrapper; } //_.intersection