MCPcopy Create free account
hub / github.com/arktypeio/arktype / parseInteger

Function parseInteger

ark/type/keywords/functions.ts:32–41  ·  view source on GitHub ↗
(
	s: string,
	ctx: Traversal,
	says?: Says
)

Source from the content-addressed store, hash-verified

30)
31
32export const parseInteger = (
33 s: string,
34 ctx: Traversal,
35 says?: Says
36): number | ArkError => {
37 const parsed = Number.parseInt(s)
38 return Number.isSafeInteger(parsed) ? parsed : (
39 ctx.error({ ...integerParseError, ...says })
40 )
41}
42
43export const parseBoolean = (s: "true" | "false"): boolean => s === "true"
44

Callers

nothing calls this directly

Calls 1

errorMethod · 0.45

Tested by

no test coverage detected