diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c083edd4c..1c4ec653f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -142,16 +142,6 @@ result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1); result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).splice(1, 2, 5, 6); result = <_.LoDashImplicitArrayWrapper>_([1, 2, 3, 4]).unshift(5, 6); -result = _('test').toString(); -result = _([1, 2, 3]).toString(); -result = _({ 'key1': 'test1', 'key2': 'test2' }).toString(); - -// _.value (aliases: _.run, _.toJSON, _.valueOf) -result = _('test').value(); -result = _([1, 2, 3]).run(); -result = <_.Dictionary>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).toJSON(); -result = <_.Dictionary>_({ a: 1, b: 2}).mapValues(function(num: number) { return num * 2; }).valueOf(); - /********* * Array * *********/ @@ -1463,6 +1453,175 @@ module TestReverse { } } +// _.prototype.run +module TestRun { + { + let result: string; + + result = _('').run(); + result = _('').chain().run(); + } + + { + let result: number; + + result = _(42).run(); + result = _(42).chain().run(); + } + + { + let result: boolean; + + result = _(true).run(); + result = _(true).chain().run(); + } + + { + let result: string[]; + + result = _([]).run(); + result = _([]).chain().run(); + } + + { + let result: {a: string}; + + result = _({a: ''}).run(); + result = _({a: ''}).chain().run(); + } +} + +// _.prototype.toJSON +module TestToJSON { + { + let result: string; + + result = _('').toJSON(); + result = _('').chain().toJSON(); + } + + { + let result: number; + + result = _(42).toJSON(); + result = _(42).chain().toJSON(); + } + + { + let result: boolean; + + result = _(true).toJSON(); + result = _(true).chain().toJSON(); + } + + { + let result: string[]; + + result = _([]).toJSON(); + result = _([]).chain().toJSON(); + } + + { + let result: {a: string}; + + result = _({a: ''}).toJSON(); + result = _({a: ''}).chain().toJSON(); + } +} + +// _.prototype.toString +module TestToString { + let result: string; + + result = _('').toString(); + result = _(42).toString(); + result = _(true).toString(); + result = _(['']).toString(); + result = _({}).toString(); + + result = _('').chain().toString(); + result = _(42).chain().toString(); + result = _(true).chain().toString(); + result = _(['']).chain().toString(); + result = _({}).chain().toString(); +} + +// _.prototype.value +module TestValue { + { + let result: string; + + result = _('').value(); + result = _('').chain().value(); + } + + { + let result: number; + + result = _(42).value(); + result = _(42).chain().value(); + } + + { + let result: boolean; + + result = _(true).value(); + result = _(true).chain().value(); + } + + { + let result: string[]; + + result = _([]).value(); + result = _([]).chain().value(); + } + + { + let result: {a: string}; + + result = _({a: ''}).value(); + result = _({a: ''}).chain().value(); + } +} + +// _.prototype.valueOf +module TestValueOf { + { + let result: string; + + result = _('').valueOf(); + result = _('').chain().valueOf(); + } + + { + let result: number; + + result = _(42).valueOf(); + result = _(42).chain().valueOf(); + } + + { + let result: boolean; + + result = _(true).valueOf(); + result = _(true).chain().valueOf(); + } + + { + let result: string[]; + + result = _([]).valueOf(); + result = _([]).chain().valueOf(); + } + + { + let result: {a: string}; + + result = _({a: ''}).valueOf(); + result = _({a: ''}).chain().valueOf(); + } +} + /************** * Collection * **************/ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 881124328..8f718a847 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2609,7 +2609,7 @@ declare module _ { reverse(): LoDashExplicitArrayWrapper; } - // _.run + //_.prototype.run interface LoDashWrapperBase { /** * @see _.value @@ -2617,7 +2617,7 @@ declare module _ { run(): T; } - // _.toJSON + //_.prototype.toJSON interface LoDashWrapperBase { /** * @see _.value @@ -2625,6 +2625,7 @@ declare module _ { toJSON(): T; } + //_.prototype.toString interface LoDashWrapperBase { /** * Produces the result of coercing the unwrapped value to a string. @@ -2634,7 +2635,7 @@ declare module _ { toString(): string; } - // _.value + //_.prototype.value interface LoDashWrapperBase { /** * Executes the chained sequence to extract the unwrapped value. @@ -2646,7 +2647,7 @@ declare module _ { value(): T; } - // _.valueOf + //_.valueOf interface LoDashWrapperBase { /** * @see _.value