UNPKG

es-next-tools

Version:

A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.

22 lines (21 loc) 811 B
/** * Capitalizes strings according to specified options. * @param {string} text - The text to capitalize. * @param {Object} options - Capitalization options. * @param {boolean} [options.all=false] - Whether to capitalize all words. * @param {string} [options.separator=' '] - The separator between words. * @returns {string} The capitalized text. * @example * // Default behavior (first letter only) * console.log(capitalize('hello world')); // 'Hello world' * * // Capitalize all words * console.log(capitalize('hello world', { all: true })); // 'Hello World' * * // Custom separator * console.log(capitalize('hello-world', { separator: '-', all: true })); // 'Hello-World' */ export declare function capitalize(text: string, options?: { all?: boolean; separator?: string; }): string;