String Utilities
Collection of string manipulation utilities.
capitalize
Capitalizes the first character of a string.
Signature:
typescript
export declare const capitalize: <T>(value: T) => string;Example:
typescript
import { capitalize } from "easy-kit-utils";
capitalize("hello world"); // 'Hello world'camelCase
Converts string to camelCase.
Signature:
typescript
export declare const camelCase: <T>(value: T) => string;Example:
typescript
import { camelCase } from "easy-kit-utils";
camelCase("Foo Bar"); // 'fooBar'
camelCase("foo-bar"); // 'fooBar'
camelCase("foo_bar"); // 'fooBar'kebabCase
Converts string to kebab-case.
Signature:
typescript
export declare const kebabCase: <T>(value: T) => string;Example:
typescript
import { kebabCase } from "easy-kit-utils";
kebabCase("fooBar"); // 'foo-bar'
kebabCase("Foo Bar"); // 'foo-bar'
kebabCase("foo_bar"); // 'foo-bar'snakeCase
Converts string to snake_case.
Signature:
typescript
export declare const snakeCase: <T>(value: T) => string;Example:
typescript
import { snakeCase } from "easy-kit-utils";
snakeCase("fooBar"); // 'foo_bar'
snakeCase("Foo Bar"); // 'foo_bar'
snakeCase("foo-bar"); // 'foo_bar'truncate
Truncates string if it's longer than the given maximum string length.
Signature:
typescript
export declare const truncate: <T>(
value: T,
length?: number,
omission?: string
) => string;Example:
typescript
import { truncate } from "easy-kit-utils";
truncate("hello world", 5); // 'he...'
truncate("hello world", 5, ".."); // 'hel..'