/** * Shared naming and case conversion utilities. * * Provides functions for transforming strings between different naming conventions * (camelCase, snake_case, kebab-case, etc.) and generating unique identifiers. */ /** * Supported naming conventions for identifiers. */ export type NameCase = 'snake' | 'kebab' | 'dot' | 'camel'; /** * Split a string into words, handling camelCase, PascalCase, and delimiters. * * @param input - The string to split * @returns Array of words * * @example * splitWords("myFunctionName") // ["my", "Function", "Name"] * splitWords("my_function_name") // ["my", "function", "name"] * splitWords("MyClassName") // ["My", "Class", "Name"] */ export declare function splitWords(input: string): string[]; /** * Convert words to a specific naming case. * * @param words - Array of words to convert * @param kind - Target naming case * @returns Converted string * * @example * toCase(["my", "function"], "snake") // "my_function" * toCase(["my", "function"], "kebab") // "my-function" * toCase(["my", "function"], "camel") // "myFunction" * toCase(["My", "Class"], "dot") // "my.class" */ export declare function toCase(words: string[], kind: NameCase): string; /** * Get the separator character for a naming case. * * @param kind - The naming case * @returns Separator character ('_', '-', '.', or '' for camelCase) */ export declare function sepFor(kind: NameCase): string; /** * Generate a short hash (6 hex chars) from a string. * Uses djb2 algorithm for fast, reasonable distribution. * * @param s - String to hash * @returns 6-character hex string * * @example * shortHash("some-string") // "a1b2c3" */ export declare function shortHash(s: string): string; /** * Ensure a name fits within a maximum length, using hash truncation if needed. * Preserves meaningful suffix while adding a hash for uniqueness. * * @param name - The name to potentially truncate * @param max - Maximum allowed length * @returns Name within max length, with hash if truncated * * @example * ensureMaxLen("short", 20) // "short" * ensureMaxLen("very-long-name-that-exceeds-limit", 20) // "very-a1b2c3-limit" */ export declare function ensureMaxLen(name: string, max: number): string; /** * Convert a string to a valid identifier by removing invalid characters. * Replaces any run of invalid characters with a hyphen. * * @param name - The string to convert * @returns Valid identifier (alphanumeric, hyphens, underscores, max 64 chars) * * @example * idFromString("My Function Name!") // "My-Function-Name" * idFromString("foo@bar#baz") // "foo-bar-baz" */ export declare function idFromString(name: string): string;