mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-04 16:04:45 +08:00
_.size definitions
This commit is contained in:
@@ -347,6 +347,10 @@ result = <number[]>_.sample([1, 2, 3, 4], 2);
|
||||
|
||||
result = <number[]>_.shuffle([1, 2, 3, 4, 5, 6]);
|
||||
|
||||
result = <number>_.size([1, 2]);
|
||||
result = <number>_.size({ 'one': 1, 'two': 2, 'three': 3 });
|
||||
result = <number>_.size('curly');
|
||||
|
||||
result = <boolean>_.some([null, 0, 'yes', false], Boolean);
|
||||
result = <boolean>_.some(foodsCombined, 'organic');
|
||||
result = <boolean>_.some(foodsCombined, { 'type': 'meat' });
|
||||
|
||||
Vendored
+24
-7
@@ -1540,7 +1540,29 @@ declare module _ {
|
||||
* @param collection The collection to shuffle.
|
||||
* @return Returns a new shuffled collection.
|
||||
**/
|
||||
export function shuffle<T>(list: Collection<T>): T[];
|
||||
export function shuffle<T>(collection: Collection<T>): 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<T>(collection: List<T>): number;
|
||||
|
||||
/**
|
||||
* @see _.size
|
||||
* @param object The object to inspect
|
||||
* @return The number of own enumerable properties.
|
||||
**/
|
||||
export function size<T extends {}>(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<T>(list: Collection<T>): 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<T>(list: Collection<T>): number;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user