MCPcopy Create free account
hub / github.com/Web3Auth/Auth / isValidNumber

Function isValidNumber

src/jrpc/errors/utils.ts:13–24  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

11type ErrorValueKey = keyof typeof errorValues;
12
13export function isValidNumber(value: unknown): value is number {
14 try {
15 if (typeof value === "number" && Number.isInteger(value)) {
16 return true;
17 }
18
19 const parsedValue = Number(value.toString());
20 return Number.isInteger(parsedValue);
21 } catch {
22 return false;
23 }
24}
25
26/**
27 * Returns whether the given code is valid.

Callers 1

constructFallbackErrorFunction · 0.90

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected