_.shuffle definitions

This commit is contained in:
Brian Zengel
2013-10-18 20:54:33 -04:00
parent ab2063780a
commit e7858021ac
2 changed files with 10 additions and 6 deletions
+2
View File
@@ -345,6 +345,8 @@ result = <IFoodCombined[]>_.reject(foodsCombined, { 'type': 'fruit' });
result = <number>_.sample([1, 2, 3, 4]);
result = <number[]>_.sample([1, 2, 3, 4], 2);
result = <number[]>_.shuffle([1, 2, 3, 4, 5, 6]);
result = <boolean>_.some([null, 0, 'yes', false], Boolean);
result = <boolean>_.some(foodsCombined, 'organic');
result = <boolean>_.some(foodsCombined, { 'type': 'meat' });
+8 -6
View File
@@ -1534,6 +1534,13 @@ declare module _ {
**/
export function sample<T>(collection: Collection<T>, n: number): T[];
/**
* Creates an array of shuffled values, using a version of the Fisher-Yates shuffle.
* See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
* @param collection The collection to shuffle.
* @return Returns a new shuffled collection.
**/
export function shuffle<T>(list: Collection<T>): T[];
/**
* Checks if the callback returns a truey value for any element of a collection. The function
@@ -1656,12 +1663,7 @@ declare module _ {
iterator: string,
context?: any): T[];
/**
* Returns a shuffled copy of the list, using a version of the Fisher-Yates shuffle.
* @param list List to shuffle.
* @return Shuffled copy of `list`.
**/
export function shuffle<T>(list: Collection<T>): T[];
/**
* Converts the list (anything that can be iterated over), into a real Array. Useful for transmuting