/** * Throws if value is not a string */ export declare function assertIsString(value: any, errorMessage?: string): asserts value is string; /** * Replaced non alphanumeric character with {@link https://drafts.csswg.org/cssom/#escape-a-character-as-code-point|CSS unicode representation} * @returns CSS safe string */ export declare const escapeCSS: (str: string) => string; /** */ export declare enum NamingConvention { KebabCase = "kebab-case", PascalCase = "pascal-case", CamelCase = "camel-case" } /** * Checks if namingConvention is supported * @returns true if namingConvention is a supported {@link NamingConvention} */ export declare function isValidNamingConvention(namingConvention: string): namingConvention is NamingConvention; /** * Capitalize the first letter of a string */ export declare function capitalizeFirstLetter(val: string): string; /** * Breaks down a string to words, dropping non letters and numbers * @example * ```ts * splitIntoWords("Hello world") // => ["Hello", "world"] * splitIntoWords("Hello123world") // => ["Hello", "123" "world"] * splitIntoWords("Hello WRL") // => ["Hello", "WRL"] * splitIntoWords("HelloWorld") // => ["Hello", "World"] * splitIntoWords("Hello_world--") // => ["Hello", "world"] * ``` * @returns An array of words contained in str */ export declare const splitIntoWords: (str: string) => string[]; /** * Converts a string to kebab-case */ export declare function toKebabCase(str: string): string; /** * Converts a string to PascalCase */ export declare function toPascalCase(str: string): string; /** * Similar to {@link toPascalCase}, but drops heading non-letters * @example * ```ts * toPascalCaseJsIdentifier("123helloWorld") // => "HelloWorld" * ``` */ export declare function toPascalCaseJsIdentifier(str: string): string; /** * Converts a string to camelCase */ export declare function toCamelCase(str: string): string; /** * Converts string formatting to a naming convention */ export declare function toNamingConvention(str: string, namingConvention: NamingConvention): string; /** * like {@link toKebabCase}, but prepends '-' if first character of input is UpperCase */ export declare function toCSSKebabCase(str: string): string; /** * like {@link toCamelCase}, but capitalizes first character if input starts with '-' */ export declare function toCSSCamelCase(str: string): string; /** * Finds line an column by position index * @returns zero based line number and character */ export declare function indexToLineAndColumn(content: string, pos: number, newline?: string): { character: number; line: number; }; /** * Checks if str contains substr ignoring capitalization */ export declare function includesCaseInsensitive(str: string, substr: string): boolean; /** * Matches the indentation of modified to the one of reference * @param reference - * @param modified - * @param newline - * @returns */ export declare function equalIdents(reference: string, modified: string, newline?: string): string; /** * Remove line indentation (heading whitespace) * @param modified- * @param separator- * @returns */ export declare function noIdents(modified: string, separator?: string): string; /** * Shifts all indentation to the left * using the line with the least indentation as a baseline */ export declare function minimalIndent(str: string): string; /** * Remove white spaces including empty lines */ export declare function noWhiteSpace(str: string): string; /** * Checks is value is a string * @param value - * @returns */ export declare const isString: (value: unknown) => value is string; /** * Similar to templated string, * given a fixed context object returns a function that parses strings in it * @param context- A context for the compiler * @returns A template compiler function which accepts a template and compile it with `context` * @example * ```ts * const compile = templateCompilerProvider({ greetings: 'Hello', person: { name: 'Elad' } }) * compile('${greetings} ${person.name}!')// => Hello Elad! * compile('${person.name} is awesome')// => Elad is awesome * ``` */ export declare function templateCompilerProvider(context: Record): (template: string) => string; /** * Returns a string safe to be used in RegExp * @see https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex */ export declare function escapeRegExp(str: string): string; //# sourceMappingURL=strings.d.ts.map