Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
⏳ Fantastic cron parser and constructor.
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
JSR Score
100%
Published
2 months ago (0.3.3)
import { parseDecimal } from "jsr:@coven/parsers@^0.3.3"; import type { RangeString } from "./RangeString.ts"; import { rangeStringTest } from "./rangeStringTest.ts"; import { RANGE_EXPRESSION_SEPARATOR_TOKEN } from "./tokens.ts"; /** * Predicate checking if given value is a cron string range * ({@linkcode RangeString}). * * @see {@linkcode RangeString} * @see {@linkcode rangeStringTest} */ export const isRangeString = (value: string): value is RangeString => rangeStringTest(value) && (([from, to]) => from <= to)( value.split(RANGE_EXPRESSION_SEPARATOR_TOKEN).map(parseDecimal) as [ from: number, to: number, ], );