// (C) 2007-2019 GoodData Corporation const isString = (value: any): boolean => typeof value === "string"; const isNumber = (value: any): boolean => typeof value === "number"; /** * Replaces non-alphanumerical characters with underscore. */ export function webalize(str: string | number): string { const isValid = isString(str) || isNumber(str); const s = isValid ? str.toString() : ""; return s.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase(); }