⏲️ Cron Quartz and Cron UNIX expression parser.
import { parseStringQuartz, parseCronQuartz } from "@vangware/cron";
const cron = parseStringQuartz("1-2/3 1-2,3,4 * 2W SEP,OCT 1L */10");
/*
{
seconds: { every: 3, start: { from: 1, to: 2 } },
minutes: [{ from: 1, to: 2 }, 3, 4],
hours: "*",
dayOfMonth: { nearest: 2 },
month: ["SEP", "OCT"],
dayOfWeek: { last: 1 },
year: { every: 10, start: "*" }
}
*/
parseCronQuartz(cron); // "1-2/3 1-2,3,4 * 2W SEP,OCT 1L */10"
import { parseStringQuartz, parseCronQuartz } from "https://cdn.skypack.dev/@vangware/cron?dts";
const cron = parseStringQuartz("1-2/3 1-2,3,4 * 2W SEP,OCT 1L */10");
/*
{
seconds: { every: 3, start: { from: 1, to: 2 } },
minutes: [{ from: 1, to: 2 }, 3, 4],
hours: "*",
dayOfMonth: { nearest: 2 },
month: ["SEP", "OCT"],
dayOfWeek: { last: 1 },
year: { every: 10, start: "*" }
}
*/
parseCronQuartz(cron); // "1-2/3 1-2,3,4 * 2W SEP,OCT 1L */10"
Documentation can be found HERE. It is auto-generated with typedoc based on the JSDocs and the types in the source. Shouldn't be necessary to read this, code editors like VSCode integrate the documentation in the UI.
Changelog can be found HERE.
Test coverage can be found HERE.
Cron day of the month value (1-31).
Cron day of week.
Cron day of week value (0-7 | SUN-SAT).
Cron day of week number value (0-7).
Cron day of week string value (SUN-SAT).
Cron every (*).
Cron hours.
Cron hours value (0-23).
Cron every (L).
Cron every ({last}L).
Cron list (value1,value2,valueN).
Cron list item.
Cron minutes.
Cron minutes value (0-59).
Cron month.
Cron month value (1-12 and JAN-DEC).
Cron month number value (1-12).
Cron month string value (JAN-DEC).
Nearest day of month ({nearest}W).
Cron part.
Cron part extended (used by CronDayOfWeek
and DayOfMonth
).
Cron object (Quartz).
Cron expression parts coming with Quartz.
Cron CronSeconds
object.
Cron CronYear
object.
Cron range (from-to).
Cron seconds.
Cron seconds value (0-59).
Cron specific day of week ({day}#{week}).
Cron start or blank value (?).
Cron steps (start/every).
Cron expression (UNIX).
Cron CronDayOfMonth
object.
Cron CronDayOfWeek
object.
Cron CronHours
object.
Cron CronMinutes
object.
Cron CronMonth
object.
Parses a value into a string or undefined
if invalid.
Cron week value (1-5).
Cron year.
Cron year value (1970-2099).
Lower and upper limit of a number value.
Parses a string into a value of given type or undefined
if invalid
Check if given is a string representing a CronDayOfWeekValue
.
Check if given is a string representing a CronMonthValue
.
Check if given is a string representing a CronRange
.
Check if given is a string representing a CronSteps
.
Parses CronHours
into a string.
Parses CronMinutes
into a string.
Parses CronMonth
into a string.
Parses CronSeconds
into a string.
Parses CronYear
into a string.
Parses a string into a CronHours
.
Parses a string into a CronMinutes
.
Parses a string into a CronMonth
.
Parses a string into a CronSeconds
.
Parses a string into a CronYear
.
Check if given is CronDayOfMonthValue
.
Value to check.
Check if given is CronDayOfWeekValue
.
Value to check.
Check if given is CronDayOfWeekValueNumber
.
Value to check.
Check if given is CronDayOfWeekValueString
.
Value to check.
Check if given is CronEvery
.
Value to check.
Check if given is CronHoursValue
.
Value to check.
Check if given is CronLast
.
Value to check.
Check if given is CronLastValue
.
Value to check.
Check if given is CronList
.
Value to check.
Check if given is CronMinutesValue
.
Value to check.
Check if given is CronMonthValue
.
Value to check.
Check if given is CronMonthValueNumber
.
Value to check.
Check if given is CronMonthValueString
.
Value to check.
Check if given is CronNearestDayOfMonth
.
Value to check.
Check if given is CronRange
.
Value to check.
Check if given is CronSecondsValue
.
Value to check.
Check if given is CronSpecificDayOfWeek
.
Value to check.
Check if given is CronStartOrBlank
.
Value to check.
Check if given is CronSteps
.
Value to check.
Check if given is CronWeekValue
.
Value to check.
Check if given is CronYearValue
.
Value to check.
Check if given is a string representing a CronDayOfMonthValue
.
Value to check.
Check if given is a string representing a CronDayOfWeekValueNumber
.
Value to check.
Check if given is a string representing a CronHoursValue
.
Value to check.
Check if given is a string representing a CronLastValue
.
Value to check.
Check if given is a string representing a CronList
.
Value to check.
Check if given is a string representing a CronMinutesValue
.
Value to check.
Check if given is a string representing a CronMonthValueNumber
.
Value to check.
Check if given is a string representing a CronNearestDayOfMonth
.
Value to check.
Check if given is a string representing a CronSecondsValue
.
Value to check.
Check if given is a string representing a CronSpecificDayOfWeek
.
Value to check.
Check if given is a string representing a CronWeekValue
.
Value to check.
Check if given is a string representing a CronYearValue
.
Value to check.
Parses CronDayOfMonth
into a string.
CronDayOfMonth
to be parsed.
A string or undefined
if invalid.
Parses CronDayOfMonthValue
into a string.
CronDayOfMonthValue
to be parsed.
A string or undefined
if invalid.
Parses CronDayOfWeek
into a string.
CronDayOfWeek
to be parsed.
A string or undefined
if invalid.
Parses CronDayOfWeekValue
into a string.
CronDayOfWeekValue
to be parsed.
A string or undefined
if invalid.
Parses a CronEvery
into a string.
CronEvery
to be parsed.
A string or undefined
if invalid.
Parses CronHoursValue
into a string.
CronHoursValue
to be parsed.
A string or undefined
if invalid.
Parses CronLast
into a string.
CronLast
to be parsed.
A string or undefined
if invalid.
Parses CronLastValue
into a string.
CronLastValue
to be parsed.
A string or undefined
if invalid.
Parses CronList
into a string.
LimitTuple
to be used when parsing CronSteps
.
Curried function with limit
on context.
Parses CronMinutesValue
into a string.
CronMinutesValue
to be parsed.
A string or undefined
if invalid.
Parses CronMonthValue
into a string.
CronMonthValue
to be parsed.
A string or undefined
if invalid.
Parses CronNearestDayOfMonth
into a string.
CronNearestDayOfMonth
to be parsed.
A string or undefined
if invalid.
Parses CronPart
into a string.
LimitTuple
to be used when parsing CronSteps
.
Curried function with limit
on context.
Parses CronQuartz
into a string.
A string or undefined
if invalid.
Parses CronRange
into a string.
CronValueParser
for CronRange
.
Curried function with parser
in context.
Parses CronSecondsValue
into a string.
CronSecondsValue
to be parsed.
A string or undefined
if invalid.
Parses CronSpecificDayOfWeek
into a string.
CronSpecificDayOfWeek
to be parsed.
A string or undefined
if invalid.
Parses CronStartOrBlank
into a string.
CronStartOrBlank
to be parsed.
A string or undefined
if invalid.
Parses CronSteps
into a string.
Curried function with limit
on context.
Parses Cron
(UNIX) into a string.
A string or undefined
if invalid.
Parses CronYearValue
into a string.
CronYearValue
to be parsed.
A string or undefined
if invalid.
Parses a string into a CronDayOfMonth
.
string to be parsed.
A CronDayOfMonth
or undefined
if invalid.
Parses a string into a CronDayOfMonthValue
.
string to be parsed.
A CronDayOfMonthValue
or undefined
if invalid.
Parses a string into a CronDayOfWeek
.
string to be parsed.
A CronDayOfWeek
or undefined
if invalid.
Parses a string into a CronDayOfWeekValue
.
string to be parsed.
A CronDayOfWeekValue
or undefined
if invalid.
Parses a string into a CronHoursValue
.
string to be parsed.
A CronHoursValue
or undefined
if invalid.
Parses a string into a CronLastValue
.
string to be parsed.
A CronLastValue
or undefined
if invalid.
Parses a string into a CronList
.
LimitTuple
to be used when parsing CronSteps
.
Curried function with limit
in context.
Parses a string into a CronMinutesValue
.
string to be parsed.
A CronMinutesValue
or undefined
if invalid.
Parses a string into a CronMonthValue
.
string to be parsed.
A CronMonthValue
or undefined
if invalid.
Parses a string into a CronNearestDayOfMonth
.
string to be parsed.
A CronNearestDayOfMonth
or undefined
if invalid.
Parses a string into a CronPart
.
LimitTuple
to be used when parsing CronSteps
.
Curried function with limit
in context.
Parses a string into a CronQuartz
.
string to be parsed.
A Cron
or undefined
if invalid.
Parses given string expression.
string to be parsed.
An array of 7 elements or undefined
if invalid.
Parses a string into a CronRange
.
StringValueParser
for CronRange
.
Curried function with parser
in context.
Parses a string into a CronSecondsValue
.
string to be parsed.
A CronSecondsValue
or undefined
if invalid.
Parses a string into a CronSpecificDayOfWeek
.
string to be parsed.
A CronSpecificDayOfWeek
or undefined
if invalid.
Parses a string into a CronSteps
.
Curried function with limit
in context.
Parses a string into a CronUnix
.
string to be parsed.
A CronUnix
or undefined
if invalid.
Parses given expression or undefined if invalid.
string to be parsed.
An array of 5 elements or undefined
if invalid.
Parses a string into a CronYearValue
.
string to be parsed.
A CronYearValue
or undefined
if invalid.
Splits given string by spaces (even if multiple).
string to be parsed.
An array with all elements of the given expression.
Checks if given search value appears just onces in given value.
Value to search.
Curried function with search
in context.
Run several validations in the same string, true if any is true.
List of validations.
Curried function with validations
in context.
Generated using TypeDoc
Cron day of month.