summaryrefslogtreecommitdiff
path: root/packages/idb-bridge/src/util/enforceRange.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/idb-bridge/src/util/enforceRange.ts')
-rw-r--r--packages/idb-bridge/src/util/enforceRange.ts20
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;