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 { has, isNumber, isObject } from "jsr:@coven/predicates@^0.3.3"; import type { RangeField } from "./RangeField.ts"; import { FROM_NAME, TO_NAME } from "./rangeFieldNames.ts"; const hasFrom = has(FROM_NAME); const hasTo = has(TO_NAME); /** * Predicate checking if given value is a cron object range ({@linkcode RangeField}). * * @see {@linkcode RangeField} */ export const isRangeField = (value: unknown): value is RangeField<number> => isObject(value) && hasFrom(value) && hasTo(value) && isNumber(value[FROM_NAME]) && isNumber(value[TO_NAME]) && value[FROM_NAME] < value[TO_NAME];