diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 494337270..064ca9904 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -347,6 +347,10 @@ result = _.sample([1, 2, 3, 4], 2); result = _.shuffle([1, 2, 3, 4, 5, 6]); +result = _.size([1, 2]); +result = _.size({ 'one': 1, 'two': 2, 'three': 3 }); +result = _.size('curly'); + result = _.some([null, 0, 'yes', false], Boolean); result = _.some(foodsCombined, 'organic'); result = _.some(foodsCombined, { 'type': 'meat' }); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 95b3186eb..1da7ff799 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1540,7 +1540,29 @@ declare module _ { * @param collection The collection to shuffle. * @return Returns a new shuffled collection. **/ - export function shuffle(list: Collection): T[]; + export function shuffle(collection: Collection): T[]; + + /** + * Gets the size of the collection by returning collection.length for arrays and array-like + * objects or the number of own enumerable properties for objects. + * @param collection The collection to inspect. + * @return collection.length + **/ + export function size(collection: List): number; + + /** + * @see _.size + * @param object The object to inspect + * @return The number of own enumerable properties. + **/ + export function size(object: T): number; + + /** + * @see _.size + * @param aString The string to inspect + * @return The length of aString + **/ + export function size(aString: string): number; /** * Checks if the callback returns a truey value for any element of a collection. The function @@ -1673,12 +1695,7 @@ declare module _ { **/ export function toArray(list: Collection): T[]; - /** - * Return the number of values in the list. - * @param list Count the number of values/elements in this list. - * @return Number of values in `list`. - **/ - export function size(list: Collection): number; +