diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d86326259..c4c29f20b 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3056,9 +3056,54 @@ result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).sample(2); result = _([1, 2, 3, 4]).sample().value(); result = _([1, 2, 3, 4]).sample(2).value(); -result = _.shuffle([1, 2, 3, 4, 5, 6]); -result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3]).shuffle(); -result = <_.LoDashImplicitArrayWrapper<_.Dictionary>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).shuffle(); +// _.shuffle +module TestShuffle { + let array: TResult[]; + let list: _.List; + let dictionary: _.Dictionary; + + { + let result: string[]; + + result = _.shuffle('abc'); + } + + { + let result: TResult[]; + + result = _.shuffle(array); + result = _.shuffle(list); + result = _.shuffle(dictionary); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').shuffle(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).shuffle(); + result = _(list).shuffle(); + result = _(dictionary).shuffle(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().shuffle(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().shuffle(); + result = _(list).chain().shuffle(); + result = _(dictionary).chain().shuffle(); + } +} result = _.size([1, 2]); result = _([1, 2]).size(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 05c3f43b9..cda766b99 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -6176,36 +6176,59 @@ declare module _ { //_.shuffle interface LoDashStatic { /** - * 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. - **/ - shuffle(collection: Array): T[]; + * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. + * + * @param collection The collection to shuffle. + * @return Returns the new shuffled array. + */ + shuffle(collection: List|Dictionary): T[]; /** - * @see _.shuffle - **/ - shuffle(collection: List): T[]; + * @see _.shuffle + */ + shuffle(collection: string): string[]; + } + interface LoDashImplicitWrapper { /** - * @see _.shuffle - **/ - shuffle(collection: Dictionary): T[]; + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { /** * @see _.shuffle - **/ + */ shuffle(): LoDashImplicitArrayWrapper; } interface LoDashImplicitObjectWrapper { /** * @see _.shuffle - **/ - shuffle(): LoDashImplicitArrayWrapper; + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; } //_.size