An npm package with random functions :)
npm i @donald.ma/utils
const isCurrency = (str: string): boolean => {
const cleanedString = str.trim().toUpperCase()
const isCrypto = Constants.cryptocurrencies[cleanedString] ? true : false
const isFiat = Constants.fiatCurrenciesData.includes(cleanedString)
return isCrypto || isFiat
}
const isNumeric = (value: any): boolean => {
return !isNaN(parseFloat(value)) && isFinite(value)
}
const jsonToQueryString = (json: object): string => {
return Object.keys(json).filter((key) => json[key] !== undefined).map((key) => {
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
}).join('&')
}