UNPKG

remeda

Version:

A utility library for JavaScript and Typescript.

49 lines 2.2 kB
//#region src/capitalize.d.ts /** * Makes first character of a string upper-case. Uses the built-in * [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) * for the runtime, and the built-in [`Capitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#capitalizestringtype) * utility type for typing. * * For other case manipulations see: `toUpperCase`, `toLowerCase`, * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toSnakeCase`. * * !IMPORTANT: This function might work _incorrectly_ for **non-ascii** inputs. * If the output is intended for display (on a browser) consider using * [the `text-transform: capitalize;` CSS property](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform) * instead! * * @param data - A string. * @signature * R.capitalize(data); * @example * R.capitalize("hello world"); // "Hello world" * @dataFirst * @category String */ declare function capitalize<T extends string>(data: T): Capitalize<T>; /** * Makes first character of a string upper-case. Uses the built-in * [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) * for the runtime, and the built-in [`Capitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#capitalizestringtype) * utility type for typing. * * For other case manipulations see: `toUpperCase`, `toLowerCase`, * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toSnakeCase`. * * !IMPORTANT: This function might work _incorrectly_ for **non-ascii** inputs. * If the output is intended for display (on a browser) consider using * [the `text-transform: capitalize;` CSS property](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform) * instead! * * @signature * R.capitalize()(data); * @example * R.pipe("hello world", R.capitalize()); // "Hello world" * @dataLast * @category String */ declare function capitalize(): <T extends string>(data: T) => Capitalize<T>; //#endregion export { capitalize }; //# sourceMappingURL=capitalize-ClF_XrXw.d.cts.map