UNPKG

cerceis-lib

Version:

Contains list of quality of life functions that is written in TypeScript and es6

50 lines (49 loc) 1.63 kB
export declare const FromString: { /** * Copy string to clipboard. This only works on browsers. * Does not work in nodeJS. * @param {string} textToCopy Text to copy. * @returns {void} void */ copyToClipboard(textToCopy: string): void; /** * Replace first N number of letter with desired string. * Does not mutate, return new string. * @param n First N number (starts from 1) * @param w Strings to replace with * @param str Input string * @returns new String */ replaceFirst(n: number, w: string, str: string): string; /** * Replace last N number of letter with desired string. * Does not mutate, return new string. * @param n Last N number (starts from 1) * @param w Strings to replace with * @param str Input string * @returns new String */ replaceLast(n: number, w: string, str: string): string; /** * Takes http cookie string as input and turn it into an object. * @param cookie * @returns */ parseCookies(cookie: string): any; /** * Removes all whitespace, symbols, specials, * leaving only string of 0~9 and a~Z. * @param str Input string * @returns cleaned String */ deepClean(str: string): string; /** * * @param str input string. * @param wordToCount word to count. * @param isolated Only count if its isolated * ex) count "apple", "i like apple" = true, "ilikeapple" = false. * @returns number of occurence. */ count(str: string, wordToCount: string, isolated?: boolean): number; };