From cbf3724b81779725e316d6a2c31baa63e801aa2d Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 26 Oct 2015 00:00:14 +0500 Subject: [PATCH] lodash: signatures of the method _.trunc changed --- lodash/lodash-tests.ts | 37 +++++++++++++++++++++++++++---------- lodash/lodash.d.ts | 13 ++++++++++++- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c083edd4cf..3da18e723e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3653,16 +3653,33 @@ result = _('-_-abc-_-').trimRight(); result = _('-_-abc-_-').trimRight('_-'); // _.trunc -result = _.trunc('hi-diddly-ho there, neighborino'); -result = _.trunc('hi-diddly-ho there, neighborino', 24); -result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); -result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); -result = _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' […]' }); -result = _('hi-diddly-ho there, neighborino').trunc(); -result = _('hi-diddly-ho there, neighborino').trunc(24); -result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': ' ' }); -result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': /,? +/ }); -result = _('hi-diddly-ho there, neighborino').trunc({ 'omission': ' […]' }); +module TestTrunc { + { + let result: string; + + result = _.trunc('hi-diddly-ho there, neighborino'); + result = _.trunc('hi-diddly-ho there, neighborino', 24); + result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); + result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); + result = _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' […]' }); + + result = _('hi-diddly-ho there, neighborino').trunc(); + result = _('hi-diddly-ho there, neighborino').trunc(24); + result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': ' ' }); + result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': /,? +/ }); + result = _('hi-diddly-ho there, neighborino').trunc({ 'omission': ' […]' }); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('hi-diddly-ho there, neighborino').chain().trunc(); + result = _('hi-diddly-ho there, neighborino').chain().trunc(24); + result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': ' ' }); + result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': /,? +/ }); + result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'omission': ' […]' }); + } +} // _.unescape result = _.unescape('fred, barney, & pebbles'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 8811243289..847374833a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9342,11 +9342,15 @@ declare module _ { /** * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated * string are replaced with the omission string which defaults to "…". + * * @param string The string to truncate. * @param options The options object or maximum string length. * @return Returns the truncated string. */ - trunc(string?: string, options?: TruncOptions|number): string; + trunc( + string?: string, + options?: TruncOptions|number + ): string; } interface LoDashImplicitWrapper { @@ -9356,6 +9360,13 @@ declare module _ { trunc(options?: TruncOptions|number): string; } + interface LoDashExplicitWrapper { + /** + * @see _.trunc + */ + trunc(options?: TruncOptions|number): LoDashExplicitWrapper; + } + //_.unescape interface LoDashStatic { /**