es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
28 lines • 901 B
text/typescript
//#region src/compat/string/words.d.ts
/**
* Splits `string` into an array of its words.
*
* @param str - The string or object that is to be split into words.
* @param [pattern] - The pattern to match words.
* @returns Returns the words of `string`.
*
* @example
* const wordsArray1 = words('fred, barney, & pebbles');
* // => ['fred', 'barney', 'pebbles']
*
*/
declare function words(string?: string, pattern?: string | RegExp): string[];
/**
* Splits `string` into an array of its words.
*
* @param str - The string or object that is to be split into words.
* @param [pattern] - The pattern to match words.
* @returns Returns the words of `string`.
*
* @example
* const wordsArray1 = words('fred, barney, & pebbles');
* // => ['fred', 'barney', 'pebbles']
*/
declare function words(string: string, index: string | number, guard: object): string[];
//#endregion
export { words };