Skip to main content

@coven/cron@0.3.3
Built and signed on GitHub Actions

⏳ Fantastic cron parser and constructor.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 months ago (0.3.3)
Package root>valueOrRangeRegExp.ts
import { group, join, optional } from "jsr:@coven/expression@^0.3.3"; import { RANGE_EXPRESSION_SEPARATOR_TOKEN } from "./tokens.ts"; /** * Regular expression to match values or ranges. * * @example * ```typescript * valueOrRangeRegExp(13); // "13(?:-13)?" * ``` * @param value Value to match by itself or as a range. * @returns RegExp to match value or range. */ export const valueOrRangeRegExp = <Value extends number | string>( value: Value, ): `${Value}(?:-${Value})?` => join(value, optional(group(RANGE_EXPRESSION_SEPARATOR_TOKEN, value)));