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>parseNumber.ts
import { parseDecimal } from "jsr:@coven/parsers@^0.3.3"; import type { Maybe } from "jsr:@coven/types@^0.3.3"; import { parseNumberTest } from "./parseNumberTest.ts"; /** * Parses a cron list into an array. * * @example * ```typescript * parseNumber("5"); // 5 * parseNumber("13"); // 13 * parseNumber("59"); // 59 * parseNumber("60"); // undefined (60 isn't valid for any cron field) * ``` * * @param value String that might be a list. * @returns Parsed list of `undefined` if it isn't a list string. */ export const parseNumber = (value: string): Maybe<number> => (parseNumberTest(value) ? parseDecimal(value) : undefined) as Maybe<number>;