1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-02 13:18:19 +00:00

rename regexps

This commit is contained in:
slowbackspace 2019-04-22 13:46:19 +02:00
parent 7da8d4124d
commit 88a0053235

View File

@ -10,10 +10,10 @@ export const hasDecimals = (value: string, decimals: number) => {
return isAbs(value); return isAbs(value);
} }
const ETH_18_RE = new RegExp( const ETH_DECIMALS_RE = new RegExp(
`^(0|0\\.([0-9]{0,${decimals}})?|[1-9][0-9]*\\.?([0-9]{0,${decimals}})?)$` `^(0|0\\.([0-9]{0,${decimals}})?|[1-9][0-9]*\\.?([0-9]{0,${decimals}})?)$`
); );
return ETH_18_RE.test(value); return ETH_DECIMALS_RE.test(value);
}; };
export const isAbs = (value: string) => { export const isAbs = (value: string) => {
@ -22,6 +22,6 @@ export const isAbs = (value: string) => {
}; };
export const isNumber = (value: string) => { export const isNumber = (value: string) => {
const ETH_18_RE = new RegExp(`^(0|0\\.([0-9]+)?|[1-9][0-9]*\\.?([0-9]+)?)$`); const NUMBER_RE = new RegExp(`^(0|0\\.([0-9]+)?|[1-9][0-9]*\\.?([0-9]+)?)$`);
return ETH_18_RE.test(value); return NUMBER_RE.test(value);
}; };