Skip to content

Commit

Permalink
Merge pull request #3998 from chrootsu/lodash-chained-shuffle
Browse files Browse the repository at this point in the history
lodash: Expose _.shuffle() in chained array and object wrappers
  • Loading branch information
vvakame committed Apr 2, 2015
2 parents b2dacce + 5229045 commit 2520bce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lodash/lodash-tests.ts
Expand Up @@ -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 });
Expand Down
14 changes: 14 additions & 0 deletions lodash/lodash.d.ts
Expand Up @@ -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 {
/**
Expand Down

0 comments on commit 2520bce

Please sign in to comment.