UNPKG

@azizbecha/strkit

Version:

strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.

12 lines (11 loc) 281 B
/** * Counts the number of words in a string * * @param str - The string to count words in * @returns The number of words * * @example * countWords('Hello world'); // 2 * countWords('This is a test'); // 4 */ export default function countWords(str: string): number;