cerceis-lib
Version:
Contains list of quality of life functions that is written in TypeScript and es6
45 lines (43 loc) • 1.61 kB
text/typescript
declare const FromString: {
/**
* Copy string to clipboard.
* Only works in browser environments — silently does nothing in Node.js.
* @param textToCopy Text to copy.
*/
copyToClipboard(textToCopy: string): void;
/**
* Replace the first N characters with the given string.
* Does not mutate — returns a new string.
* @param n First N characters to replace (starts from 1)
* @param w Replacement string (must have length === n)
* @param str Input string
*/
replaceFirst(n: number, w: string, str: string): string;
/**
* Replace the last N characters with the given string.
* Does not mutate — returns a new string.
* @param n Last N characters to replace (starts from 1)
* @param w Replacement string (must have length === n)
* @param str Input string
*/
replaceLast(n: number, w: string, str: string): string;
/**
* Parse an HTTP cookie string into a key/value object.
* @param cookie Raw cookie string
*/
parseCookies(cookie: string): Record<string, string>;
/**
* Remove all whitespace, symbols, and special characters.
* Leaves only 0–9 and a–Z.
* @param str Input string
*/
deepClean(str: string): string;
/**
* Count occurrences of a word within a string.
* @param str Input string.
* @param wordToCount Word to count.
* @param isolated Only count when the word appears as a standalone word (space-bounded).
*/
count(str: string, wordToCount: string, isolated?: boolean): number;
};
export { FromString };