diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 75185f898..b83e6a201 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1839,8 +1839,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 772b6bc32..27a2c129e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7850,8 +7850,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[]; } /***********