diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 00ca144fd..3bc21ed4e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1825,8 +1825,11 @@ result = _('hi-diddly-ho there, neighborino').trunc({ 'omission': ' [… result = _.unescape('fred, barney, & pebbles'); result = _('fred, barney, & pebbles').unescape(); +// _.words result = _.words('fred, barney, & pebbles'); result = _.words('fred, barney, & pebbles', /[^, ]+/g); +result = _('fred, barney, & pebbles').words(); +result = _('fred, barney, & pebbles').words(/[^, ]+/g); /********** * Utilities * diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 77daeca2a..0e86d6651 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7816,8 +7816,22 @@ declare module _ { unescape(): string; } + //_.words interface LoDashStatic { - words(str?: string, pattern?: string|RegExp): string[]; + /** + * Splits string into an array of its words. + * @param string The string to inspect. + * @param pattern The pattern to match words. + * @return Returns the words of string. + */ + words(string?: string, pattern?: string|RegExp): string[]; + } + + interface LoDashWrapper { + /** + * @see _.words + */ + words(pattern?: string|RegExp): string[]; } /***********