UNPKG

hili-lipsum

Version:

Hilichurlian language lorem ipsum generator and web scraper

52 lines (51 loc) 2.21 kB
/** * Remove special characters and special patterns on a string * @param {object} param - Input parameters * @param {string} param.string - String to process and format * @param {boolean} param.removePlural - Flag to remove the string pattern "(plural: <any_word>)" from the string * @returns {string|undefined} Formatted string or undefined */ export function removeSpecialChars({ string, removePlural }: { string: string; removePlural: boolean; }): string | undefined; /** * Retrieves words enclosed in a parenthesis from strings following a _"I, me (plural: mimi)"_ format. * Optionally removes words in the `excludes[]` array. * @param {object} param - Input parameters * @param {string} param.string - Input string * @param {string[]} param.excludes - String array of word/s to exclude from the result * @returns {string|undefined} Extracted words or the original string. Returns undefined if string input is invalid. */ export function getParenthesisWords({ string, excludes }: { string: string; excludes: string[]; }): string | undefined; /** * Retrives words that go before an openning parenthesis character * @param {object} param - Input parameters * @param {string} param.string - Input string * @returns {string|undefined} Extracted words or the original string. Returns undefined if string input is invalid. */ export function getParenthesisStartWords({ string }: { string: string; }): string | undefined; /** * Write a single or array of JavaScript objects to a JSON file. * Creates a JSON file on the specified filename location. * @param {object} param - Input parameters * @param {object[]} param.data - Array of simple JavaScript objects * @param {string} param.filename - Full file path to the target destination file * @returns {void} */ export function saveToJSON({ data, filename }: { data: object[]; filename: string; }): void; /** * Stalls function execution by `timeout` milliseconds * @param {() => void} callback - Callback function to execute after `timeout` milliseconds * @param {number} timeout - Milliseconds timeout delay * @returns {void} */ export function delayProcess(callback: () => void, timeout?: number): void;