Download libs/utils/dist/string-utils.d.ts from Leon4gr45/automaker: direct link, hf CLI and curl.
- Browser
- Download file 3.55 kB
-
https://huggingface.co/spaces/Leon4gr45/automaker/resolve/main/libs/utils/dist/string-utils.d.ts
- Command line
-
hf download hf://spaces/Leon4gr45/automaker/libs/utils/dist/string-utils.d.ts
-
curl -L -o string-utils.d.ts https://huggingface.co/spaces/Leon4gr45/automaker/resolve/main/libs/utils/dist/string-utils.d.ts
3.55 kB
| /** | |
| * String utility functions for common text operations | |
| */ | |
| /** | |
| * Truncate a string to a maximum length, adding an ellipsis if truncated | |
| * @param str - The string to truncate | |
| * @param maxLength - Maximum length of the result (including ellipsis) | |
| * @param ellipsis - The ellipsis string to use (default: '...') | |
| * @returns The truncated string | |
| */ | |
| export declare function truncate(str: string, maxLength: number, ellipsis?: string): string; | |
| /** | |
| * Convert a string to kebab-case (e.g., "Hello World" -> "hello-world") | |
| * @param str - The string to convert | |
| * @returns The kebab-case string | |
| */ | |
| export declare function toKebabCase(str: string): string; | |
| /** | |
| * Convert a string to camelCase (e.g., "hello-world" -> "helloWorld") | |
| * @param str - The string to convert | |
| * @returns The camelCase string | |
| */ | |
| export declare function toCamelCase(str: string): string; | |
| /** | |
| * Convert a string to PascalCase (e.g., "hello-world" -> "HelloWorld") | |
| * @param str - The string to convert | |
| * @returns The PascalCase string | |
| */ | |
| export declare function toPascalCase(str: string): string; | |
| /** | |
| * Capitalize the first letter of a string | |
| * @param str - The string to capitalize | |
| * @returns The string with first letter capitalized | |
| */ | |
| export declare function capitalize(str: string): string; | |
| /** | |
| * Remove duplicate whitespace from a string, preserving single spaces | |
| * @param str - The string to clean | |
| * @returns The string with duplicate whitespace removed | |
| */ | |
| export declare function collapseWhitespace(str: string): string; | |
| /** | |
| * Check if a string is empty or contains only whitespace | |
| * @param str - The string to check | |
| * @returns True if the string is blank | |
| */ | |
| export declare function isBlank(str: string | null | undefined): boolean; | |
| /** | |
| * Check if a string is not empty and contains non-whitespace characters | |
| * @param str - The string to check | |
| * @returns True if the string is not blank | |
| */ | |
| export declare function isNotBlank(str: string | null | undefined): boolean; | |
| /** | |
| * Safely parse a string to an integer, returning a default value on failure | |
| * @param str - The string to parse | |
| * @param defaultValue - The default value if parsing fails (default: 0) | |
| * @returns The parsed integer or the default value | |
| */ | |
| export declare function safeParseInt(str: string | null | undefined, defaultValue?: number): number; | |
| /** | |
| * Generate a slug from a string (URL-friendly identifier) | |
| * @param str - The string to convert to a slug | |
| * @param maxLength - Optional maximum length for the slug | |
| * @returns The slugified string | |
| */ | |
| export declare function slugify(str: string, maxLength?: number): string; | |
| /** | |
| * Escape special regex characters in a string | |
| * @param str - The string to escape | |
| * @returns The escaped string safe for use in a RegExp | |
| */ | |
| export declare function escapeRegex(str: string): string; | |
| /** | |
| * Pluralize a word based on count | |
| * @param word - The singular form of the word | |
| * @param count - The count to base pluralization on | |
| * @param pluralForm - Optional custom plural form (default: word + 's') | |
| * @returns The word in singular or plural form | |
| */ | |
| export declare function pluralize(word: string, count: number, pluralForm?: string): string; | |
| /** | |
| * Format a count with its associated word (e.g., "1 item", "3 items") | |
| * @param count - The count | |
| * @param singular - The singular form of the word | |
| * @param plural - Optional custom plural form | |
| * @returns Formatted string with count and word | |
| */ | |
| export declare function formatCount(count: number, singular: string, plural?: string): string; | |
| //# sourceMappingURL=string-utils.d.ts.map |