diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9062500a9e..2539bf4054 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -155,17 +155,24 @@ result = _([1, 2, 3]).run(); result = <_.Dictionary>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).toJSON(); result = <_.Dictionary>_({ a: 1, b: 2}).mapValues(function(num: number) { return num * 2; }).valueOf(); -// /************* -// * Arrays * -// *************/ -result = _.chunk([1, '2', '3', false]); -result = <_.LoDashArrayWrapper>_([1, '2', '3', false]).chunk(); -result = _.chunk([1, '2', '3', false], 2); -result = <_.LoDashArrayWrapper>_([1, '2', '3', false]).chunk(2); -result = _.chunk([1, 2, 3, 4]); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).chunk(); -result = _.chunk([1, 2, 3, 4], 2); -result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).chunk(2); +/********* + * Array * + *********/ + +// _.chunk +module TestChunk { + let array: TResult[]; + let list: _.List; + let result: TResult[][]; + result = _.chunk(array); + result = _.chunk(array, 42); + result = _.chunk(list); + result = _.chunk(list, 42); + result = _(array).chunk().value(); + result = _(array).chunk(42).value(); + result = _(list).chunk().value(); + result = _(list).chunk(42).value(); +} result = _.compact([0, 1, false, 2, '', 3]); result = <_.LoDashArrayWrapper>_([0, 1, false, 2, '', 3]).compact(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 6a6291ac07..d06d5427f9 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -313,33 +313,39 @@ declare module _ { } /********* - * Arrays * - **********/ + * Array * + *********/ //_.chunk interface LoDashStatic { /** - * Creates an array of elements split into groups the length of size. If collection can't be - * split evenly, the final chunk will be the remaining elements. - * @param array The array to process. - * @param size The length of each chunk. - * @return Returns the new array containing chunks. - **/ - chunk(array: Array, size?: number): T[][]; - - /** - * @see _.chunk - **/ - chunk(array: List, size?: number): T[][]; + * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the + * final chunk will be the remaining elements. + * + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + */ + chunk( + array: List, + size?: number + ): T[][]; } interface LoDashArrayWrapper { /** - * @see _.chunk - **/ + * @see _.chunk + */ chunk(size?: number): LoDashArrayWrapper; } + interface LoDashObjectWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashArrayWrapper; + } + //_.compact interface LoDashStatic { /**