isValidNanoPattern
Signature
Section titled “Signature”isValidNanoPattern(value: string): booleanisValidNanoPattern(value: void | {} | null | undefined): booleanisValidNanoPattern(value: unknown): value is stringValidate whether a string is a nanosecond timestamp parseNanoseconds will parse.
parseNanosecondsreturns0nfor both"0"and garbage, so this is how the two are told apart — the check its own JSDoc asks callers to make.- Shape and range: a canonical decimal integer (optional
-, digits, no leading zeros) that also falls inside whatTemporal.Instantcan represent. Shape alone isnanosecondDecimalinregex/. - Length is checked before
BigInt, so an arbitrarily long payload string is rejected rather than converted. - Takes the string value, not JSON text —
JSON.parse(payload).observedAt, not the payload. A quoted"\"123\""is not a decimal integer. - A value that is not a string, a
Stringobject included, returnsfalse. Atrueresult narrows anunknownvalue tostring.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | any value; a string is checked as the decimal string form of a nanosecond timestamp |
Returns
Section titled “Returns”boolean indicating whether parseNanoseconds will parse it
Examples
Section titled “Examples”import { isValidNanoPattern } from "@northguild/gmt/precision/validate";
isValidNanoPattern("1710072000123456789") // trueSource
Section titled “Source”Accessibility
© 2026 NorthGuild · Licences
Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.