/** * Replace backslash to slash * * @category String * @example * ``` * slash('C:\\Users\\Chris') => 'C:/Users/Chris' * ``` */ export declare function slash(str: string): string; /** * Ensure prefix of a string * * @category String * @example * ``` * ensurePrefix('https://', 'google.com') => 'https://google.com' * ensurePrefix('https://', 'http://google.com') => 'https://google.com' */ export declare function ensurePrefix(prefix: string, str: string): string; /** * Ensure suffix of a string * * @category String * @example * ``` * ensureSuffix('.js', 'index') => 'index.js' * ensureSuffix('.js', 'index.js') => 'index.js' * ``` */ export declare function ensureSuffix(suffix: string, str: string): string; /** * Dead simple template engine, just like Python's `.format()` * * @category String * @example * ``` * const result = template('Hello {0}! My name is {1}.', * 'Buddy', * 'Chris' * ) // Hello Buddy! My name is Chris. * ``` */ export declare function template(str: string, ...args: any[]): string; export declare function truncate(str: string, length: number, end?: string): string; /** * Generate a random string. * * Uses `crypto.getRandomValues()` so the result is suitable for tokens, * password reset codes, API keys, and any other security-sensitive use — * `Math.random()` is predictable and would let an attacker reproduce * "random" tokens given enough sample output. * * @category String */ export declare function random(size?: number, dict?: string): string; /** * Slugify a string * @category string * @example * ``` * slug('Hello World') => 'hello-world' * ``` */ export declare function slug(str: string, options?: SlugOptions): string; // port from nanoid // https://github.com/ai/nanoid export declare const urlAlphabet: 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'; declare interface SlugOptions { replacement?: string remove?: RegExp lower?: boolean strict?: boolean locale?: string trim?: boolean } export * from './detect-indent'; export * from './detect-newline';