diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-08-03 13:00:48 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-08-03 13:01:05 +0530 |
commit | ffd2a62c3f7df94365980302fef3bc3376b48182 (patch) | |
tree | 270af6f16b4cc7f5da2afdba55c8bc9dbea5eca5 /packages/idb-bridge/src/util/enforceRange.ts | |
parent | aa481e42675fb7c4dcbbeec0ba1c61e1953b9596 (diff) | |
download | wallet-core-ffd2a62c3f7df94365980302fef3bc3376b48182.tar.xz |
modularize repo, use pnpm, improve typechecking
Diffstat (limited to 'packages/idb-bridge/src/util/enforceRange.ts')
-rw-r--r-- | packages/idb-bridge/src/util/enforceRange.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/packages/idb-bridge/src/util/enforceRange.ts b/packages/idb-bridge/src/util/enforceRange.ts index 9ac472757..87e135798 100644 --- a/packages/idb-bridge/src/util/enforceRange.ts +++ b/packages/idb-bridge/src/util/enforceRange.ts @@ -18,18 +18,18 @@ // https://heycam.github.io/webidl/#EnforceRange const enforceRange = ( - num: number, - type: "MAX_SAFE_INTEGER" | "unsigned long", + num: number, + type: "MAX_SAFE_INTEGER" | "unsigned long", ) => { - const min = 0; - const max = type === "unsigned long" ? 4294967295 : 9007199254740991; + const min = 0; + const max = type === "unsigned long" ? 4294967295 : 9007199254740991; - if (isNaN(num) || num < min || num > max) { - throw new TypeError(); - } - if (num >= 0) { - return Math.floor(num); - } + if (isNaN(num) || num < min || num > max) { + throw new TypeError(); + } + if (num >= 0) { + return Math.floor(num); + } }; export default enforceRange; |