UNPKG

ice.fo.utils

Version:

112 lines (83 loc) 3.21 kB
declare module "ice.fo.utils/StringUtils" { export function formatStringBlocks(text: string, blocks: any, delimiter: string = '-'); export function escapeRegExp(string: any); export function getKoreanCharacters(text: string); export function getNonKoreanCharacters(text: string); export function getNumbericTexts(text: string); export function getNumberTextOnly(text: string); export function addParamsToUrl(text: string, obj: any); export function convertToQueryObject(undefined: any); export function getFilename(context: any); /** * Doc: https://stackoverflow.com/questions/190852/how-can-i-get-file-extensions-with-javascript "" --> "" "name" --> "" "name.txt" --> "txt" ".htpasswd" --> "" "name.with.many.dots.myext" --> "myext" */ export function getFilePathExtension(text: string); /** * Parse inline styles string to object * * Ex: "display: block; width: 100%;" => { display: 'block'; width: '100%' } * @param {*} text * @returns */ export function convertToStylesObject(text: string); /** * Ex: replaceAll("find text to replace with text", "text", "Nikochin") => "find Nikochin to replace with Nikochin" * @param {*} text String input * @param {*} find String to find * @param {*} by String to replace with */ export function replaceAll(text: string, find: any, by: any); /** * Ex: formatString({ username: "Nikochin" }, "{username} comes to rescue") => "Nikochin comes to rescue" * @param {*} target Object contains values * @param {*} pattern String input */ export function formatStringValue(target: any, pattern: any, funcs: any, prefix: string = '{', suffix: string = '}'); /** * Find and return list of string that enclosed between [left] and [right] characters * * Ex: getStringBetweenCharacters('The {brown} fox jump over the {box}.', '{', '}') * * => [brown, box] * * @param {string} text * @param {string} left * @param {string} right * @returns */ export function getStringBetweenCharacters(text: string, left: any, right: any); /** * Korean is 2 bytes each character * Else 1 byte * * @param {*} text */ export function countSimpleStringBytes(text: string); /** * Format Korean Mobile */ export function formatMobileText(text: string); /** * Format Korean Tel */ export function formatTelText(text: string); /** * http://localhost:8080/productImage/file/202110/06/e84739fa-757e-4f93-a0e1-2e2780cbe5db.png/09.sample_thum01.png * -> * http://localhost:8080/productImage/file/202110/06/e84739fa-757e-4f93-a0e1-2e2780cbe5db.png */ export function getFilePathFromStorePath(value: any); /** * width: 300 * height: 0 * http://localhost:8080/productImage/file/202110/06/e84739fa-757e-4f93-a0e1-2e2780cbe5db.png/09.sample_thum01.png * -> * http://localhost:8080/image/productImage/file/202110/06/300/0/e84739fa-757e-4f93-a0e1-2e2780cbe5db.png */ export function getResizeImagePath(context: any); }