MCPcopy Create free account
hub / github.com/TanStack/query / parsePositiveInt

Function parsePositiveInt

examples/lit/pagination/server/index.mjs:37–48  ·  view source on GitHub ↗
(rawValue, fallback)

Source from the content-addressed store, hash-verified

35}
36
37function parsePositiveInt(rawValue, fallback) {
38 if (rawValue == null || rawValue === '') {
39 return fallback
40 }
41
42 const parsed = Number.parseInt(rawValue, 10)
43 if (!Number.isInteger(parsed) || parsed < 1) {
44 return undefined
45 }
46
47 return parsed
48}
49
50function parseNonNegativeInt(rawValue, fallback) {
51 if (rawValue == null || rawValue === '') {

Callers 1

index.mjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected