LendAndRegret/node_modules/es-toolkit/dist/string/words.d.mts
2026-05-02 17:27:43 +08:00

21 lines
593 B
TypeScript

/**
* Splits `string` into an array of its words, treating spaces and punctuation marks as separators.
*
* @param {string} str The string to inspect.
* @param {RegExp | string} [pattern] The pattern to match words.
* @returns {string[]} Returns the words of `string`.
*
* @example
* words('fred, barney, & pebbles');
* // => ['fred', 'barney', 'pebbles']
*
* words('camelCaseHTTPRequest🚀');
* // => ['camel', 'Case', 'HTTP', 'Request', '🚀']
*
* words('Lunedì 18 Set')
* // => ['Lunedì', '18', 'Set']
*/
declare function words(str: string): string[];
export { words };