lodash: signatures of the method _.words changed

This commit is contained in:
Ilya Mochalov
2015-10-26 23:06:36 +05:00
parent b104f61d0e
commit 5e48b49014
2 changed files with 30 additions and 5 deletions
+18 -4
View File
@@ -3988,10 +3988,24 @@ result = <string>_.unescape('fred, barney, &amp; pebbles');
result = <string>_('fred, barney, &amp; pebbles').unescape();
// _.words
result = <string[]>_.words('fred, barney, & pebbles');
result = <string[]>_.words('fred, barney, & pebbles', /[^, ]+/g);
result = <string[]>_('fred, barney, & pebbles').words();
result = <string[]>_('fred, barney, & pebbles').words(/[^, ]+/g);
module TestWords {
{
let result: string[];
result = _.words('fred, barney, & pebbles');
result = _.words('fred, barney, & pebbles', /[^, ]+/g);
result = _('fred, barney, & pebbles').words();
result = _('fred, barney, & pebbles').words(/[^, ]+/g);
}
{
let result: _.LoDashExplicitArrayWrapper<string>;
result = _('fred, barney, & pebbles').chain().words();
result = _('fred, barney, & pebbles').chain().words(/[^, ]+/g);
}
}
/***********
* Utility *
+12 -1
View File
@@ -9638,11 +9638,15 @@ declare module _ {
interface LoDashStatic {
/**
* 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[];
words(
string?: string,
pattern?: string|RegExp
): string[];
}
interface LoDashImplicitWrapper<T> {
@@ -9652,6 +9656,13 @@ declare module _ {
words(pattern?: string|RegExp): string[];
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.words
*/
words(pattern?: string|RegExp): LoDashExplicitArrayWrapper<string>;
}
/***********
* Utility *
***********/