UNPKG

stringzy

Version:

A versatile string manipulation library providing a range of text utilities for JavaScript and Node.js applications.

27 lines (26 loc) 877 B
/** * Converts a given string to PascalCase format. * * The conversion process includes: * - Trimming whitespace from both ends. * - Converting all characters to lowercase. * - Replacing non-word characters and underscores with spaces. * - Collapsing multiple spaces into a single space. * - Capitalizing the first letter of each word. * - Removing all spaces to produce the PascalCase output. * * If the input is `null` or `undefined`, an empty string is returned. * * @param {string} text - The input string to convert. * @returns {string} The PascalCase formatted string. * * @example * pascalCase("hello world"); // "HelloWorld" * * @example * pascalCase("convert_to-pascal.case"); // "ConvertToPascalCase" * * @example * pascalCase(" multiple spaces here "); // "MultipleSpacesHere" */ export declare function pascalCase(text: string): string;