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

Function parseNonNegativeInt

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

Source from the content-addressed store, hash-verified

48}
49
50function parseNonNegativeInt(rawValue, fallback) {
51 if (rawValue == null || rawValue === '') {
52 return fallback
53 }
54
55 const parsed = Number.parseInt(rawValue, 10)
56 if (!Number.isInteger(parsed) || parsed < 0) {
57 return undefined
58 }
59
60 return parsed
61}
62
63function resetState() {
64 projects = createSeedProjects()

Callers 1

index.mjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected