@newdash/newdash
Version:
javascript/typescript utility library
21 lines (20 loc) • 535 B
TypeScript
/**
* Splits `string` into an array of its words.
*
* @since 5.12.0
* @category String
* @param string The string to inspect.
* @param pattern The pattern to match words.
* @returns Returns the words of `string`.
* @example
*
* ```js
* words('fred, barney, & pebbles')
* // => ['fred', 'barney', 'pebbles']
*
* words('fred, barney, & pebbles', /[^, ]+/g)
* // => ['fred', 'barney', '&', 'pebbles']
* ```
*/
export declare function words(string: string, pattern?: RegExp | string): Array<string>;
export default words;