parseAsIndex
const parseAsIndex: Parser<number>;Defined in: tanstack/core/built-in-parsers.ts:135
Page index: the URL is 1-indexed, state is 0-indexed (?page=1 ⇄ 0).
Fits TanStack Table’s pageIndex while keeping human-friendly URLs.
Example
Section titled “Example”import { parseAsIndex } from "@xtandard/lib/tanstack";
parseAsIndex.parse("1"); // → 0parseAsIndex.parse("3"); // → 2parseAsIndex.serialize(0); // → "1"
const pageIndex = parseAsIndex.withDefault(0); // no ?page → 0