UNPKG

dotaconstants

Version:

Constant data for Dota 2 applications

26 lines (20 loc) 568 B
export const HTML_REGEX = /(<([^>]+)>)/gi; export const mapAbilities = (tokens: any) => { const tokenKeys = Object.keys(tokens); tokenKeys.forEach( (key) => (tokens[key] = tokens[key].replace(HTML_REGEX, "")), ); return tokens; }; export const removeExtraneousWhitespacesFromString = (string: string) => { if (!string) { return ""; } return string.replace(/\s+/g, " ").trim(); }; export const cleanupArray = (array: string[]) => { if (!array) { return []; } return array.filter((n) => removeExtraneousWhitespacesFromString(n)); };