export type Words = string extends S ? string[] : _Words; type _Words< S extends string, TTemp extends string = '', TLastIsBlank extends boolean = false, > = S extends `${infer THead}${infer TTail}` ? THead extends ' ' | '\n' | '\r' | '\t' ? _Words : TLastIsBlank extends true ? TTemp extends '' ? _Words : [TTemp, ..._Words] : _Words : [TTemp]; /** * Split a string separated by spaces into an array of words. * @param str The string to split. * * @example * ```typescript * words('foo bar baz'); // => ['foo', 'bar', '', 'baz'] * ``` * * @example * ```typescript * const colors = words('red green blue'); // colors :: ['red', 'green', 'blue'] * * const trafficLights: string = 'red yellow green'; * const trafficLightsState = words(trafficLights); // trafficLightsState :: string[] * ``` */ declare const words: (str: S) => Words; export default words; //# sourceMappingURL=words.d.ts.map