isChronVer
import { isChronVer } from "jsr:@ende/chronver";function
function isChronVer(value: unknown): value is ChronVerChecks to see if value is a valid ChronVer object: one that
format accepts and that parse reads back unchanged.
The year must be from 1 to 9999, the date a real calendar date and the
changeset a non-negative safe integer. The feature, if present, may only
contain letters, digits and hyphens (not only hyphens), can't be break,
and can't be combined with isBreaking.
Objects which are valid ChronVer objects but have extra fields are still considered ChronVer objects and this will return true.
A type assertion is added to the value.
value: unknownThe value to check to see if it's a valid ChronVer object
Returns
true if value is a valid ChronVer, false otherwise
Example: Usage
import { isChronVer } from "@ende/chronver/is-chronver";
import { assert, assertFalse } from "@ende/assert";
assert(isChronVer({ year: 2024, month: 4, day: 3, changeset: 0, isBreaking: false }));
assertFalse(isChronVer({ year: 2024, month: 4, day: 31, changeset: 0, isBreaking: false }));