Expose _.shuffle() in chained array and object wrappers

This commit is contained in:
Ilya Mochalov
2015-03-31 01:04:56 +05:00
parent f8f1b95d00
commit 5229045da8
2 changed files with 16 additions and 0 deletions

View File

@@ -565,6 +565,8 @@ 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 = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).shuffle();
result = <_.LoDashArrayWrapper<_.Dictionary<string>>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).shuffle();
result = <number>_.size([1, 2]);
result = <number>_.size({ 'one': 1, 'two': 2, 'three': 3 });

14
lodash/lodash.d.ts vendored
View File

@@ -4398,6 +4398,20 @@ declare module _ {
shuffle<T>(collection: Dictionary<T>): T[];
}
interface LoDashArrayWrapper<T> {
/**
* @see _.shuffle
**/
shuffle(): LoDashArrayWrapper<T>;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.shuffle
**/
shuffle(): LoDashArrayWrapper<T>;
}
//_.size
interface LoDashStatic {
/**