UNPKG

fallout-utility

Version:
45 lines (44 loc) 1.75 kB
import { RestOrArray } from '../types'; import kleur from 'kleur'; export { kleur }; /** * Escape a string to be used as a regular expression * @param string Escape regex from this string */ export declare function escapeRegExp(string: string): string; /** * Trim characters from string * @param string Trim characters from this string * @param chars Trim this characters from string */ export declare function trimChars(string: string, ...chars: RestOrArray<string>): string; /** * Detects the string if has the given prefixes * @param string Check this string for prefixes * @param find Check if string starts with at least one of these strings */ export declare function startsWith(string: string, ...find: RestOrArray<string>): boolean; /** * Limit text to a certain number of characters with a suffix */ export declare function limitString(string?: string, limit?: number, endsWith?: string | undefined): string; /** * Split a string into an array of strings * @param string String to split * @param removeQuotations Whether to trim quotation marks from the string if they exist * @param separator Split separator */ export declare function splitString(string: string, removeQuotations?: boolean, separator?: string): string[]; /** * Removes extra spaces from text * @param text Text to remove extra spaces from */ export declare function removeUnecessarySpaces(text: string): string; /** * Find and replace characters in a string * @param string Original string * @param find Strings to find * @param replace Replacement strings */ export declare function replaceAll(string: string, find: string[], replace: string[]): string; export declare function replaceAll(string: string, find: string, replace: string): string;