diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 0c1fd15b4..d1fc4e72c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -443,8 +443,19 @@ result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, * Collection * **************/ -result = _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); -result = _.at(['moe', 'larry', 'curly'], 0, 2); +// _.at +{ + let testAtArray: TResult[]; + let testAtList: _.List; + let testAtDictionary: _.Dictionary; + let result: TResult[]; + result = _.at(testAtArray, 0, '1', [2], ['3'], [4, '5']); + result = _.at(testAtList, 0, '1', [2], ['3'], [4, '5']); + result = _.at(testAtDictionary, 0, '1', [2], ['3'], [4, '5']); + result = _(testAtArray).at(0, '1', [2], ['3'], [4, '5']).value(); + result = _(testAtList).at(0, '1', [2], ['3'], [4, '5']).value(); + result = _(testAtDictionary).at(0, '1', [2], ['3'], [4, '5']).value(); +} result = _.contains([1, 2, 3], 1); result = _.contains([1, 2, 3], 1, 2); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 4f6b9efa3..fee53ca1f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2063,51 +2063,31 @@ declare module _ { //_.at interface LoDashStatic { /** - * Creates an array of elements from the specified indexes, or keys, of the collection. - * Indexes may be specified as individual arguments or as arrays of indexes. - * @param collection The collection to iterate over. - * @param indexes The indexes of collection to retrieve, specified as individual indexes or - * arrays of indexes. - * @return A new array of elements corresponding to the provided indexes. - **/ + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param collection The collection to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ at( - collection: Array, - indexes: number[]): T[]; + collection: List|Dictionary, + ...props: Array> + ): T[]; + } + interface LoDashArrayWrapper { /** - * @see _.at - **/ - at( - collection: List, - indexes: number[]): T[]; + * @see _.at + */ + at(...props: Array>): LoDashArrayWrapper; + } + interface LoDashObjectWrapper { /** - * @see _.at - **/ - at( - collection: Dictionary, - indexes: number[]): T[]; - - /** - * @see _.at - **/ - at( - collection: Array, - ...indexes: number[]): T[]; - - /** - * @see _.at - **/ - at( - collection: List, - ...indexes: number[]): T[]; - - /** - * @see _.at - **/ - at( - collection: Dictionary, - ...indexes: number[]): T[]; + * @see _.at + */ + at(...props: Array>): LoDashArrayWrapper; } //_.contains