Skip to content

Cron Reference

Coverage License NPM Version Open Issues Size

⏲️ Cron Quartz and Cron UNIX expression parser.

Usage

📦 Node

Install @lou.codes/cron as a dependency:

Terminal window
1
pnpm add @lou.codes/cron
2
# or
3
npm install @lou.codes/cron
4
# or
5
yarn add @lou.codes/cron

Import it and use it:

1
import { parseStringQuartz, parseCronQuartz } from "@lou.codes/cron";
2
3
const cron = parseStringQuartz("1-2/3 1-2,3,4 * 2W SEP,OCT 1L */10");
4
/*
5
{
6
seconds: { every: 3, start: { from: 1, to: 2 } },
7
minutes: [{ from: 1, to: 2 }, 3, 4],
8
hours: "*",
9
dayOfMonth: { nearest: 2 },
10
month: ["SEP", "OCT"],
11
dayOfWeek: { last: 1 },
12
year: { every: 10, start: "*" }
13
}
14
*/
15
16
parseCronQuartz(cron); // "1-2/3 1-2,3,4 * 2W SEP,OCT 1L */10"

🦕 Deno

Import @lou.codes/cron using the npm: prefix, and use it directly:

1
import { parseStringQuartz, parseCronQuartz } from "npm:@lou.codes/cron";
2
3
const cron = parseStringQuartz("1-2/3 1-2,3,4 * 2W SEP,OCT 1L */10");
4
/*
5
{
6
seconds: { every: 3, start: { from: 1, to: 2 } },
7
minutes: [{ from: 1, to: 2 }, 3, 4],
8
hours: "*",
9
dayOfMonth: { nearest: 2 },
10
month: ["SEP", "OCT"],
11
dayOfWeek: { last: 1 },
12
year: { every: 10, start: "*" }
13
}
14
*/
15
16
parseCronQuartz(cron); // "1-2/3 1-2,3,4 * 2W SEP,OCT 1L */10"

🌎 Browser

Import @lou.codes/cron using esm.sh, and use it directly:

1
<script type="module">
2
import {
3
parseStringQuartz,
4
parseCronQuartz,
5
} from "https://esm.sh/@lou.codes/cron";
6
7
const cron = parseStringQuartz("1-2/3 1-2,3,4 * 2W SEP,OCT 1L */10");
8
/*
9
{
10
seconds: { every: 3, start: { from: 1, to: 2 } },
11
minutes: [{ from: 1, to: 2 }, 3, 4],
12
hours: "*",
13
dayOfMonth: { nearest: 2 },
14
month: ["SEP", "OCT"],
15
dayOfWeek: { last: 1 },
16
year: { every: 10, start: "*" }
17
}
18
*/
19
20
parseCronQuartz(cron); // "1-2/3 1-2,3,4 * 2W SEP,OCT 1L */10"
21
</script>

To do

A big change is coming with stricter types and a better DX. Stay tuned.

Common

splitExpression

splitExpression(source): string[]

Splits given string by spaces (even if multiple).

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

string[]

An array with all elements of the given expression.

Example

1
splitExpression(" 1 2 3 4 5 "); // ["1", "2", "3", "4", "5"]
2
splitExpression("1 2 3 4 5"); // ["1", "2", "3", "4", "5"]
3
splitExpression("12345"); // ["12345"]

View source


validateOr

validateOr(...validations): (value: unknown) => boolean

Run several validations in the same string, true if any is true.

Parameters

NameTypeDescription
...validationsreadonly (value: unknown) => boolean[]List of validations.

Returns

fn

Curried function with validations in context.

▸ (value): boolean

Parameters
NameType
valueunknown
Returns

boolean

Example

1
validateOr([])("1"); // false
2
3
validateOr([item => item === "1", item => parseInt(item as string, 10) === 1])(
4
"1",
5
); // true
6
7
validateOr([item => item === "1", item => parseInt(item as string, 10) === 2])(
8
"1",
9
); // true
10
11
validateOr([item => item === "2", item => parseInt(item as string, 10) === 2])(
12
"1",
13
); // false

View source

Other

CronDayOfMonth

Cron day of month.

View source


CronDayOfMonthValue

Ƭ CronDayOfMonthValue: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31

Cron day of the month value (1-31).

View source


CronDayOfWeek

Cron day of week.

View source


CronDayOfWeekValue

Cron day of week value (0-7 | SUN-SAT).

View source


CronDayOfWeekValueNumber

Ƭ CronDayOfWeekValueNumber: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7

Cron day of week number value (0-7).

View source


CronDayOfWeekValueString

Ƭ CronDayOfWeekValueString: "FRI" | "MON" | "SAT" | "SUN" | "THU" | "TUE" | "WED"

Cron day of week string value (SUN-SAT).

View source


CronEvery

Ƭ CronEvery: typeof CRON_EVERY

Cron every (*).

View source


CronHours

Ƭ CronHours: CronPart<CronHoursValue>

Cron hours.

View source


CronHoursValue

Ƭ CronHoursValue: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23

Cron hours value (0-23).

View source


CronLast

Ƭ CronLast: typeof CRON_LAST

Cron every (L).

View source


CronLastValue

Ƭ CronLastValue: Object

Cron last object. It gets turned into the string ${last}L.

Type declaration

NameType
lastCronDayOfWeekValueNumber

View source


CronList

Ƭ CronList<Value>: ReadonlyArray<CronListItem<Value>>

Cron list (value1,value2,valueN).

Type parameters

Name
Value

View source


CronListItem

Ƭ CronListItem<Value>: CronRange<Value> | CronSteps<Value> | Value

Cron list item.

Type parameters

Name
Value

View source


CronMinutes

Ƭ CronMinutes: CronPart<CronMinutesValue>

Cron minutes.

View source


CronMinutesValue

Ƭ CronMinutesValue: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59

Cron minutes value (0-59).

View source


CronMonth

Ƭ CronMonth: CronPart<CronMonthValue>

Cron month.

View source


CronMonthValue

Cron month value (1-12 and JAN-DEC).

View source


CronMonthValueNumber

Ƭ CronMonthValueNumber: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12

Cron month number value (1-12).

View source


CronMonthValueString

Ƭ CronMonthValueString: "APR" | "AUG" | "DEC" | "FEB" | "JAN" | "JUL" | "JUN" | "MAR" | "MAY" | "NOV" | "OCT" | "SEP"

Cron month string value (JAN-DEC).

View source


CronNearest

Ƭ CronNearest: typeof CRON_NEAREST

Cron every (W).

View source


CronNearestDayOfMonth

Ƭ CronNearestDayOfMonth: Object

Nearest day of month object It gets turned into the string ${nearest}W.

Type declaration

NameType
nearestCronDayOfMonthValue

View source


CronPart

Ƭ CronPart<Value>: CronEvery | CronList<Value> | CronRange<Value> | CronSteps<Value> | Value

Cron part.

Type parameters

Name
Value

View source


CronPartExtended

Ƭ CronPartExtended<Value>: CronLast | CronPart<Value> | CronStartOrBlank

Cron part extended (used by CronDayOfWeek and DayOfMonth).

Type parameters

Name
Value

View source


CronQuartz

Ƭ CronQuartz: CronQuartzExtension & CronUnix

Cron object (Quartz).

View source


CronQuartzExtension

Ƭ CronQuartzExtension: Object

Cron expression parts coming with Quartz.

Type declaration

NameTypeDescription
secondsCronSecondsCron CronSeconds object.
yearCronYearCron CronYear object.

View source


CronRange

Ƭ CronRange<Value>: Object

Cron range (from-to).

Type parameters

Name
Value

Type declaration

NameType
fromValue
toValue

View source


CronSeconds

Ƭ CronSeconds: CronPart<CronSecondsValue>

Cron seconds.

View source


CronSecondsValue

Ƭ CronSecondsValue: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59

Cron seconds value (0-59).

View source


CronSpecificDayOfWeek

Ƭ CronSpecificDayOfWeek: Object

Cron specific day of week object. It gets turned into the string ${day}#${week}.

Type declaration

NameType
dayCronDayOfWeekValueNumber
weekCronWeekValue

View source


CronStartOrBlank

Ƭ CronStartOrBlank: typeof CRON_START_OR_BLANK

Cron start or blank value (?).

View source


CronSteps

Ƭ CronSteps<Value>: Object

Cron steps (start/every).

Type parameters

Name
Value

Type declaration

NameType
everynumber
startCronEvery | CronRange<Value> | Value

View source


CronUnix

Ƭ CronUnix: Object

Cron expression (UNIX).

Type declaration

NameTypeDescription
dayOfMonthCronDayOfMonthCron CronDayOfMonth object.
dayOfWeekCronDayOfWeekCron CronDayOfWeek object.
hoursCronHoursCron CronHours object.
minutesCronMinutesCron CronMinutes object.
monthCronMonthCron CronMonth object.

View source


CronValueParser

Ƭ CronValueParser<Value>: Unary<Value, Maybe<string>>

Parses a value into a string or undefined if invalid.

Type parameters

Name
Value

View source


CronWeekValue

Ƭ CronWeekValue: 1 | 2 | 3 | 4 | 5

Cron week value (1-5).

View source


CronYear

Ƭ CronYear: CronPart<CronYearValue>

Cron year.

View source


CronYearValue

Ƭ CronYearValue: 1970 | 1971 | 1972 | 1973 | 1974 | 1975 | 1976 | 1977 | 1978 | 1979 | 1980 | 1981 | 1982 | 1983 | 1984 | 1985 | 1986 | 1987 | 1988 | 1989 | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | 1999 | 2000 | 2001 | 2002 | 2003 | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 | 2027 | 2028 | 2029 | 2030 | 2031 | 2032 | 2033 | 2034 | 2035 | 2036 | 2037 | 2038 | 2039 | 2040 | 2041 | 2042 | 2043 | 2044 | 2045 | 2046 | 2047 | 2048 | 2049 | 2050 | 2051 | 2052 | 2053 | 2054 | 2055 | 2056 | 2057 | 2058 | 2059 | 2060 | 2061 | 2062 | 2063 | 2064 | 2065 | 2066 | 2067 | 2068 | 2069 | 2070 | 2071 | 2072 | 2073 | 2074 | 2075 | 2076 | 2077 | 2078 | 2079 | 2080 | 2081 | 2082 | 2083 | 2084 | 2085 | 2086 | 2087 | 2088 | 2089 | 2090 | 2091 | 2092 | 2093 | 2094 | 2095 | 2096 | 2097 | 2098 | 2099

Cron year value (1970-2099).

View source


LimitTuple

Ƭ LimitTuple: readonly [lowerLimit: number, upperLimit: number]

Lower and upper limit of a number value.

View source


StringValueParser

Ƭ StringValueParser<Value>: Unary<string, Maybe<Value>>

Parses a string into a value of given type or undefined if invalid

Type parameters

Name
Value

View source


CRON_EVERY

Const CRON_EVERY: "*"

View source


CRON_LAST

Const CRON_LAST: "L"

View source


CRON_LIST_SEPARATOR

Const CRON_LIST_SEPARATOR: ","

View source


CRON_NEAREST

Const CRON_NEAREST: "W"

View source


CRON_RANGE_SEPARATOR

Const CRON_RANGE_SEPARATOR: "-"

View source


CRON_SPECIFIC_SEPARATOR

Const CRON_SPECIFIC_SEPARATOR: "#"

View source


CRON_START_OR_BLANK

Const CRON_START_OR_BLANK: "?"

View source


CRON_STEPS_SEPARATOR

Const CRON_STEPS_SEPARATOR: "/"

View source


QUARTZ_DAY_OF_MONTH_POSITION

Const QUARTZ_DAY_OF_MONTH_POSITION: 3

View source


QUARTZ_DAY_OF_WEEK_POSITION

Const QUARTZ_DAY_OF_WEEK_POSITION: 5

View source


QUARTZ_HOURS_POSITION

Const QUARTZ_HOURS_POSITION: 2

View source


QUARTZ_MINUTES_POSITION

Const QUARTZ_MINUTES_POSITION: 1

View source


QUARTZ_MONTH_POSITION

Const QUARTZ_MONTH_POSITION: 4

View source


QUARTZ_SECONDS_POSITION

Const QUARTZ_SECONDS_POSITION: 0

View source


QUARTZ_YEAR_POSITION

Const QUARTZ_YEAR_POSITION: 6

View source


UNIX_DAY_OF_MONTH_POSITION

Const UNIX_DAY_OF_MONTH_POSITION: 2

View source


UNIX_DAY_OF_WEEK_POSITION

Const UNIX_DAY_OF_WEEK_POSITION: 4

View source


UNIX_HOURS_POSITION

Const UNIX_HOURS_POSITION: 1

View source


UNIX_MINUTES_POSITION

Const UNIX_MINUTES_POSITION: 0

View source


UNIX_MONTH_POSITION

Const UNIX_MONTH_POSITION: 3

View source


isCronSecondsValue

isCronSecondsValue(value): value is CronSecondsValue

Check if given is CronSecondsValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronSecondsValue

Returns true if is CronSecondsValue, false otherwise.

Example

1
isCronSecondsValue(30); // true
2
isCronSecondsValue(80); // false

View source

Parsers

parseCronDayOfMonth

parseCronDayOfMonth(source): Maybe<string>

Parses CronDayOfMonth into a string.

Parameters

NameTypeDescription
sourceCronDayOfMonthCronDayOfMonth to be parsed.

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronDayOfMonth(10); // "10"
2
parseCronDayOfMonth("*"); // "*"
3
parseCronDayOfMonth("?"); // "?"
4
parseCronDayOfMonth({ every: 10, start: 2 }); // "2/10"
5
parseCronDayOfMonth({ every: 10, start: "L" }); // "L/10"
6
parseCronDayOfMonth([1, 2, 3, 4]); // "1,2,3,4"
7
parseCronDayOfMonth({ from: 5, to: 10 }); // "5-10"
8
parseCronDayOfMonth([1, 2, 3, 4, { from: 5, to: 10 }]); // "1,2,3,4,5-10"
9
parseCronDayOfMonth("L"); // "L"
10
parseCronDayOfMonth({ nearest: 1 }); // "1W"
11
parseCronDayOfMonth({ every: 99, start: "*" }); // undefined

View source


parseCronDayOfMonthValue

parseCronDayOfMonthValue(input): Maybe<string>

Parses CronDayOfMonthValue into a string.

Parameters

NameType
inputCronDayOfMonthValue

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronDayOfMonthValue(1); // "1"
2
parseCronDayOfMonthValue(31); // "31"
3
parseCronDayOfMonthValue(99); // undefined

View source


parseCronDayOfWeek

parseCronDayOfWeek(source): Maybe<string>

Parses CronDayOfWeek into a string.

Parameters

NameTypeDescription
sourceCronDayOfWeekCronDayOfWeek to be parsed.

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronDayOfWeek(6); // "6"
2
parseCronDayOfWeek("*"); // "*"
3
parseCronDayOfWeek("?"); // "?"
4
parseCronDayOfWeek({ every: 6, start: 2 }); // "2/6"
5
parseCronDayOfWeek({ every: 6, start: "L" }); // "L/6"
6
parseCronDayOfWeek([1, 2, 3, 4]); // "1,2,3,4"
7
parseCronDayOfWeek({ from: 1, to: 5 }); // "1-5"
8
parseCronDayOfWeek({ from: "MON", to: "SAT" }); // "MON-SAT"
9
parseCronDayOfWeek([1, 2, 3, { from: 5, to: 7 }]); // "1,2,3,5-7"
10
parseCronDayOfWeek("L"); // "L"
11
parseCronDayOfWeek({ last: 2 }); // "2L"
12
parseCronDayOfWeek({ day: 1, week: 5 }); // "1#5"

View source


parseCronDayOfWeekValue

parseCronDayOfWeekValue(input): Maybe<string>

Parses CronDayOfWeekValue into a string.

Parameters

NameType
inputCronDayOfWeekValue

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronDayOfWeekValue(1); // "1"
2
parseCronDayOfWeekValue(7); // "7"
3
parseCronDayOfWeekValue(99); // undefined

View source


parseCronEvery

parseCronEvery(source): undefined | "*"

Parses a CronEvery into a string.

Parameters

NameTypeDescription
sourcestringCronEvery to be parsed.

Returns

undefined | "*"

A string or undefined if invalid.

Example

1
parseCronEvery("*"); // "*"
2
parseCronEvery("💩"); // undefined

View source


parseCronHours

parseCronHours(source): Maybe<string>

Parses CronHours into a string.

Parameters

NameTypeDescription
source"*" | CronHoursValue | CronList<CronHoursValue> | CronRange<CronHoursValue> | CronSteps<CronHoursValue>CronHours to be parsed.

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronHours(10); // "10"
2
parseCronHours("*"); // "*"
3
parseCronHours({ every: 10, start: 2 }); // "2/10"
4
parseCronHours([1, 2, 3, 4]); // "1,2,3,4"
5
parseCronHours({ from: 5, to: 10 }); // "5-10"
6
parseCronHours([1, 2, 3, 4, { from: 5, to: 10 }]); // "1,2,3,4,5-10"

View source


parseCronHoursValue

parseCronHoursValue(input): Maybe<string>

Parses CronHoursValue into a string.

Parameters

NameType
inputCronHoursValue

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronHoursValue(10); // "10"
2
parseCronHoursValue(23); // "23"
3
parseCronHoursValue(99); // undefined

View source


parseCronLast

parseCronLast(source): undefined | "L"

Parses CronLast into a string.

Parameters

NameTypeDescription
sourcestringCronLast to be parsed.

Returns

undefined | "L"

A string or undefined if invalid.

Example

1
parseCronLast("L"); // "L"
2
parseCronLast("💩"); // undefined

View source


parseCronLastValue

parseCronLastValue(source): undefined | string

Parses CronLastValue into a string.

Parameters

NameTypeDescription
sourceCronLastValueCronLastValue to be parsed.

Returns

undefined | string

A string or undefined if invalid.

Example

1
parseCronLastValue({ last: 1 }); // "1L"
2
parseCronLastValue({ last: 99 }); // undefined

View source


parseCronList

parseCronList(limit): <Value>(parser: CronValueParser<Value>) => (source: CronList<Value>) => undefined | string

Parses CronList into a string.

Parameters

NameTypeDescription
limitLimitTupleLimitTuple to be used when parsing CronSteps.

Returns

fn

Curried function with limit on context.

▸ <Value>(parser): (source: CronList<Value>) => undefined | string

Type parameters
Name
Value
Parameters
NameType
parserCronValueParser<Value>
Returns

fn

▸ (source): undefined | string

Parameters
NameType
sourceCronList<Value>
Returns

undefined | string

Example

1
const parseCronSecondsList = parseCronList([0, 59])(parseCronSecondsValue);
2
3
parseCronSecondsList([13, 10]); // "13,10",
4
parseCronSecondsList([{ from: 13, to: 10 }, 10]); // "13-10,10",
5
parseCronSecondsList([{ every: 10, start: 13 }, 10]); // "13/10,10",
6
parseCronSecondsList([{ every: 10, start: { from: 13, to: 10 } }, 10]); // "13-10/10,10"
7
parseCronSecondsList([{ every: 10, start: "L" }, 10]); // "L/10,10"
8
parseCronSecondsList([]); // undefined

View source


parseCronMinutes

parseCronMinutes<Source>(source): Maybe<string>

Parses CronMinutes into a string.

Type parameters

NameType
Sourceextends number

Parameters

NameTypeDescription
source"*" | Source | CronList<Source> | CronRange<Source> | CronSteps<Source>CronMinutes to be parsed.

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronMinutes(10); // "10"
2
parseCronMinutes("*"); // "*"
3
parseCronMinutes({ every: 10, start: 2 }); // "2/10"
4
parseCronMinutes([1, 2, 3, 4]); // "1,2,3,4"
5
parseCronMinutes({ from: 5, to: 10 }); // "5-10"
6
parseCronMinutes([1, 2, 3, 4, { from: 5, to: 10 }]); // "1,2,3,4,5-10"

View source


parseCronMinutesValue

parseCronMinutesValue<Source>(source): Source extends CronMinutesValue ? `${Source<Source>}` : Maybe<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | "25" | "26" | "27" | "28" | "29" | "30" | "31" | "32" | "33" | "34" | "35" | "36" | "37" | "38" | "39" | "40" | "41" | "42" | "43" | "44" | "45" | "46" | "47" | "48" | "49" | "50" | "51" | "52" | "53" | "54" | "55" | "56" | "57" | "58" | "59">

Parses CronMinutesValue into a string.

Type parameters

NameType
Sourceextends number

Parameters

NameTypeDescription
sourceSourceCronMinutesValue to be parsed.

Returns

Source extends CronMinutesValue ? `${Source<Source>}` : Maybe<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | "25" | "26" | "27" | "28" | "29" | "30" | "31" | "32" | "33" | "34" | "35" | "36" | "37" | "38" | "39" | "40" | "41" | "42" | "43" | "44" | "45" | "46" | "47" | "48" | "49" | "50" | "51" | "52" | "53" | "54" | "55" | "56" | "57" | "58" | "59">

A string or undefined if invalid.

Example

1
parseCronMinutesValue(0); // "0"
2
parseCronMinutesValue(59); // "59"

View source


parseCronMonth

parseCronMonth(source): Maybe<string>

Parses CronMonth into a string.

Parameters

NameTypeDescription
source"*" | CronMonthValue | CronList<CronMonthValue> | CronRange<CronMonthValue> | CronSteps<CronMonthValue>CronMonth to be parsed.

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronMonth(10); // "10"
2
parseCronMonth("*"); // "*"
3
parseCronMonth({ every: 6, start: 2 }); // "2/6"
4
parseCronMonth([1, 2, 3, 4]); // "1,2,3,4"
5
parseCronMonth({ from: 1, to: 5 }); // "1-5"
6
parseCronMonth({ from: "JAN", to: "OCT" }); // "JAN-OCT"
7
parseCronMonth([1, 2, 3, { from: 5, to: 7 }]); // "1,2,3,5-7"

View source


parseCronMonthValue

parseCronMonthValue(input): Maybe<string>

Parses CronMonthValue into a string.

Parameters

NameType
inputCronMonthValue

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronMonthValue(1); // "1"
2
parseCronMonthValue(12); // "12"
3
parseCronMonthValue(99); // undefined

View source


parseCronNearestDayOfMonth

parseCronNearestDayOfMonth(source): undefined | string

Parses CronNearestDayOfMonth into a string.

Parameters

NameTypeDescription
sourceCronNearestDayOfMonthCronNearestDayOfMonth to be parsed.

Returns

undefined | string

A string or undefined if invalid.

Example

1
parseCronNearestDayOfMonth({ nearest: 2 }); // "2W"
2
parseCronNearestDayOfMonth({ nearest: 99 }); // undefined

View source


parseCronPart

parseCronPart(limit): <Value>(parser: CronValueParser<Value>) => (source: "*" | Value | CronList<Value> | CronRange<Value> | CronSteps<Value>) => Maybe<string>

Parses CronPart into a string.

Parameters

NameTypeDescription
limitLimitTupleLimitTuple to be used when parsing CronSteps.

Returns

fn

Curried function with limit on context.

▸ <Value>(parser): (source: "*" | Value | CronList<Value> | CronRange<Value> | CronSteps<Value>) => Maybe<string>

Type parameters
Name
Value
Parameters
NameType
parserCronValueParser<Value>
Returns

fn

▸ (source): Maybe<string>

Parameters
NameType
source"*" | Value | CronList<Value> | CronRange<Value> | CronSteps<Value>
Returns

Maybe<string>

Example

1
const parseCronPartSeconds = parseCronPart([0, 59])(parseCronSecondsValue);
2
3
parseCronPartSeconds("*"); // "*"
4
parseCronPartSeconds([13, 10]); // "13,10"
5
parseCronPartSeconds([{ from: 13, to: 10 }, 10]); // "13-10,10"
6
parseCronPartSeconds([{ every: 10, start: 13 }, 10]); // "13/10,10"
7
parseCronPartSeconds([{ every: 99, start: 13 }, 10]); // undefined
8
parseCronPartSeconds([
9
{
10
every: 10,
11
start: { from: 13, to: 10 },
12
},
13
10,
14
]); // "13-10/10,10"
15
parseCronPartSeconds([{ every: 10, start: "?" }, 10]); // "?/10,10"
16
parseCronPartSeconds({ every: 10, start: 13 }); // "13/10"
17
parseCronPartSeconds({
18
every: 10,
19
start: { from: 13, to: 10 },
20
}); // "13-10/10"
21
parseCronPartSeconds({ every: 10, start: "?" }); // "?/10"
22
parseCronPartSeconds({
23
from: 13,
24
to: 10,
25
}); // "13-10"

View source


parseCronQuartz

parseCronQuartz(cronQuartz): undefined | string

Parses CronQuartz into a string.

Parameters

NameType
cronQuartzCronQuartz

Returns

undefined | string

A string or undefined if invalid.

Example

1
parseCronQuartz({
2
dayOfMonth: "*",
3
dayOfWeek: "*",
4
hours: "*",
5
minutes: "*",
6
month: "*",
7
seconds: "*",
8
year: "*",
9
}); // wanted: "* * * * * * *"
10
parseCronQuartz({
11
dayOfMonth: [1, 2],
12
dayOfWeek: [1, 2],
13
hours: [1, 2],
14
minutes: [1, 2],
15
month: [1, 2],
16
seconds: [1, 2],
17
year: [1989, 2020],
18
}); // "1,2 1,2 1,2 1,2 1,2 1,2 1989,2020"
19
parseCronQuartz({
20
dayOfMonth: { from: 1, to: 2 },
21
dayOfWeek: { from: 1, to: 2 },
22
hours: { from: 1, to: 2 },
23
minutes: { from: 1, to: 2 },
24
month: { from: 1, to: 2 },
25
seconds: { from: 1, to: 2 },
26
year: { from: 1989, to: 2020 },
27
}); // "1-2 1-2 1-2 1-2 1-2 1-2 1989-2020"
28
parseCronQuartz({
29
dayOfMonth: { every: 2, start: 1 },
30
dayOfWeek: { every: 2, start: 1 },
31
hours: { every: 2, start: 1 },
32
minutes: { every: 2, start: 1 },
33
month: { every: 2, start: 1 },
34
seconds: { every: 2, start: 1 },
35
year: { every: 10, start: 1989 },
36
}); // "1/2 1/2 1/2 1/2 1/2 1/2 1989/10"
37
parseCronQuartz({
38
dayOfMonth: { nearest: 2 },
39
dayOfWeek: { last: 1 },
40
hours: "*",
41
minutes: [{ from: 1, to: 2 }, 3, 4],
42
month: ["SEP", "OCT"],
43
seconds: { every: 3, start: { from: 1, to: 2 } },
44
year: { every: 10, start: "?" },
45
}); // "1-2/3 1-2,3,4 * 2W SEP,OCT 1L ?/10",
46
parseCronQuartz({
47
dayOfMonth: undefined,
48
dayOfWeek: "*",
49
hours: "*",
50
minutes: "*",
51
month: "*",
52
seconds: "*",
53
year: "*",
54
}); // undefined,

View source


parseCronRange

parseCronRange<Value>(parser): (source: CronRange<Value>) => undefined | string

Parses CronRange into a string.

Type parameters

Name
Value

Parameters

NameTypeDescription
parserCronValueParser<Value>CronValueParser for CronRange.

Returns

fn

Curried function with parser in context.

▸ (source): undefined | string

Parameters
NameType
sourceCronRange<Value>
Returns

undefined | string

Example

1
parseCronRangeSeconds({ from: 13, to: 10 }); // "13-10"
2
parseCronRangeSeconds({ from: 999, to: 999 }); // undefined

View source


parseCronSeconds

parseCronSeconds(source): Maybe<string>

Parses CronSeconds into a string.

Parameters

NameTypeDescription
source"*" | CronSecondsValue | CronList<CronSecondsValue> | CronRange<CronSecondsValue> | CronSteps<CronSecondsValue>CronSeconds to be parsed.

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronSeconds(10); // "10",
2
parseCronSeconds("*"); // "*",
3
parseCronSeconds({ every: 10, start: 2 }); // "2/10",
4
parseCronSeconds([1, 2, 3, 4]); // "1,2,3,4",
5
parseCronSeconds({ from: 5, to: 10 }); // "5-10",
6
parseCronSeconds([1, 2, 3, 4, { from: 5, to: 10 }]); // "1,2,3,4,5-10",

View source


parseCronSecondsValue

parseCronSecondsValue(input): Maybe<string>

Parses CronSecondsValue into a string.

Parameters

NameType
inputCronSecondsValue

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronSecondsValue(10); // "10"
2
parseCronSecondsValue(59); // "59"
3
parseCronSecondsValue(99); // undefined

View source


parseCronSpecificDayOfWeek

parseCronSpecificDayOfWeek(source): undefined | string

Parses CronSpecificDayOfWeek into a string.

Parameters

NameTypeDescription
sourcestring | CronSpecificDayOfWeekCronSpecificDayOfWeek to be parsed.

Returns

undefined | string

A string or undefined if invalid.

Example

1
parseCronSpecificDayOfWeek({ day: 1, week: 5 }); // "1#5"
2
parseCronSpecificDayOfWeek({ day: 99, week: 99 }); // undefined

View source


parseCronStartOrBlank

parseCronStartOrBlank(source): undefined | "?"

Parses CronStartOrBlank into a string.

Parameters

NameTypeDescription
sourcestringCronStartOrBlank to be parsed.

Returns

undefined | "?"

A string or undefined if invalid.

Example

1
parseCronStartOrBlank("?"); // "?"
2
parseCronStartOrBlank("💩"); // undefined

View source


parseCronSteps

parseCronSteps(limit): <Value>(parser: CronValueParser<Value>) => (source: CronSteps<Value>) => undefined | string

Parses CronSteps into a string.

Parameters

NameTypeDescription
limitLimitTupleLimitTuple to be used when parsing CronSteps.

Returns

fn

Curried function with limit on context.

▸ <Value>(parser): (source: CronSteps<Value>) => undefined | string

Type parameters
Name
Value
Parameters
NameType
parserCronValueParser<Value>
Returns

fn

▸ (source): undefined | string

Parameters
NameType
sourceCronSteps<Value>
Returns

undefined | string

Example

1
const parseCronStepsSeconds = parseCronSteps([0, 59])(parseCronSecondsValue);
2
3
parseCronStepsSeconds({ every: 10, start: 13 }); // "13/10"
4
parseCronStepsSeconds({ every: 99, start: 13 }); // undefined
5
parseCronStepsSeconds({
6
every: 10,
7
start: { from: 13, to: 10 },
8
}); // "13-10/10"
9
parseCronStepsSeconds({ every: 10, start: "?" }); // "?/10"

View source


parseCronUnix

parseCronUnix(cronUnix): undefined | string

Parses Cron (UNIX) into a string.

Parameters

NameType
cronUnixCronUnix

Returns

undefined | string

A string or undefined if invalid.

Example

1
parseCronUnix({
2
dayOfMonth: "*",
3
dayOfWeek: "*",
4
hours: "*",
5
minutes: "*",
6
month: "*",
7
}); // "* * * * *"
8
parseCronUnix({
9
dayOfMonth: [1, 2],
10
dayOfWeek: [1, 2],
11
hours: [1, 2],
12
minutes: [1, 2],
13
month: [1, 2],
14
}); // "1,2 1,2 1,2 1,2 1,2"
15
parseCronUnix({
16
dayOfMonth: { from: 1, to: 2 },
17
dayOfWeek: { from: 1, to: 2 },
18
hours: { from: 1, to: 2 },
19
minutes: { from: 1, to: 2 },
20
month: { from: 1, to: 2 },
21
}); // "1-2 1-2 1-2 1-2 1-2"
22
parseCronUnix({
23
dayOfMonth: { every: 2, start: 1 },
24
dayOfWeek: { every: 2, start: 1 },
25
hours: { every: 2, start: 1 },
26
minutes: { every: 2, start: 1 },
27
month: { every: 2, start: 1 },
28
}); // "1/2 1/2 1/2 1/2 1/2"
29
parseCronUnix({
30
dayOfMonth: { nearest: 2 },
31
dayOfWeek: { last: 1 },
32
hours: "*",
33
minutes: [{ from: 1, to: 2 }, 3, 4],
34
month: ["SEP", "OCT"],
35
}); // "1-2,3,4 * 2W SEP,OCT 1L"
36
parseCronUnix({
37
dayOfMonth: undefined,
38
dayOfWeek: "*",
39
hours: "*",
40
minutes: "*",
41
month: "*",
42
}); // undefined

View source


parseCronYear

parseCronYear(source): Maybe<string>

Parses CronYear into a string.

Parameters

NameTypeDescription
source"*" | CronYearValue | CronList<CronYearValue> | CronRange<CronYearValue> | CronSteps<CronYearValue>CronYear to be parsed.

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronYear(1989); // "1989"
2
parseCronYear("*"); // "*"
3
parseCronYear({ every: 10, start: 1989 }); // "1989/10"
4
parseCronYear({ every: 10, start: "?" }); // "?/10"
5
parseCronYear([1989, 1991, 2015, 2020]); // "1989,1991,2015,2020"
6
parseCronYear({ from: 1989, to: 2020 }); // "1989-2020"
7
parseCronYear([1989, 1989, 1991, 2015, 2020, { from: 1989, to: 2020 }]); // "1989,1991,2015,2020,1989-2020"

View source


parseCronYearValue

parseCronYearValue(input): Maybe<string>

Parses CronYearValue into a string.

Parameters

NameType
inputCronYearValue

Returns

Maybe<string>

A string or undefined if invalid.

Example

1
parseCronYearValue(1989); // "1989"
2
parseCronYearValue(2022); // "2022"
3
parseCronYearValue(1969); // undefined
4
parseCronYearValue(3000); // undefined

View source


parseStringDayOfMonth

parseStringDayOfMonth(source): Maybe<CronDayOfMonth>

Parses a string into a CronDayOfMonth.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

Maybe<CronDayOfMonth>

A CronDayOfMonth or undefined if invalid.

Example

1
parseStringDayOfMonth("10"); // 10,
2
parseStringDayOfMonth("*"); // "*",
3
parseStringDayOfMonth("?"); // "?",
4
parseStringDayOfMonth("2/10"); // { every: 10, start: 2 },
5
parseStringDayOfMonth("?/10"); // { every: 10, start: "?" },
6
parseStringDayOfMonth("1,2,3,4"); // [1, 2, 3, 4],
7
parseStringDayOfMonth("5-10"); // { from: 5, to: 10 },
8
parseStringDayOfMonth("1,2,3,4,5-10"); // [1, 2, 3, 4, { from: 5, to: 10 }],
9
parseStringDayOfMonth("L"); // "L",
10
parseStringDayOfMonth("1W"); // { nearest: 1 },
11
parseStringDayOfMonth("INVALID"); // undefined,
12
parseStringDayOfMonth("1,2,3,4,INVALID"); // undefined,

View source


parseStringDayOfMonthValue

parseStringDayOfMonthValue(input): Maybe<CronDayOfMonthValue>

Parses a string into a CronDayOfMonthValue.

Parameters

NameType
inputstring

Returns

Maybe<CronDayOfMonthValue>

A CronDayOfMonthValue or undefined if invalid.

Example

1
parseStringDayOfMonthValue("13"); // 13
2
parseStringDayOfMonthValue("99"); // undefined

View source


parseStringDayOfWeek

parseStringDayOfWeek(source): Maybe<CronDayOfWeek>

Parses a string into a CronDayOfWeek.

Parameters

NameTypeDescription
sourcestringString to be parsed.

Returns

Maybe<CronDayOfWeek>

A CronDayOfWeek or undefined if invalid.

Example

1
parseStringDayOfWeek("6"); // 6
2
parseStringDayOfWeek("*"); // "*"
3
parseStringDayOfWeek("?"); // "?"
4
parseStringDayOfWeek("2/6"); // { every: 6, start: 2 }
5
parseStringDayOfWeek("?/6"); // { every: 6, start: "?" }
6
parseStringDayOfWeek("1,2,3,4"); // [1, 2, 3, 4]
7
parseStringDayOfWeek("1-5"); // { from: 1, to: 5 }
8
parseStringDayOfWeek("MON-SAT"); // { from: "MON", to: "SAT" }
9
parseStringDayOfWeek("mon-sat"); // { from: "MON", to: "SAT" }
10
parseStringDayOfWeek("1,2,3,5-7"); // [1, 2, 3, { from: 5, to: 7 }]
11
parseStringDayOfWeek("L"); // "L"
12
parseStringDayOfWeek("2L"); // { last: 2 }
13
parseStringDayOfWeek("1#5"); // { day: 1, week: 5 }
14
parseStringDayOfWeek("INVALID"); // undefined
15
parseStringDayOfWeek("1,2,3,4,INVALID"); // undefined

View source


parseStringDayOfWeekValue

parseStringDayOfWeekValue(input): Maybe<CronDayOfWeekValue>

Parses a string into a CronDayOfWeekValue.

Parameters

NameType
inputstring

Returns

Maybe<CronDayOfWeekValue>

A CronDayOfWeekValue or undefined if invalid.

Example

1
parseStringDayOfWeekValue("5"); // 5
2
parseStringDayOfWeekValue("FRI"); // "FRI"
3
parseStringDayOfWeekValue("fri"); // "FRI"
4
parseStringDayOfWeekValue("8"); // undefined
5
parseStringDayOfWeekValue("IDK"); // undefined

View source


parseStringHours

parseStringHours(source): Maybe<CronPart<CronHoursValue>>

Parses a string into a CronHours.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

Maybe<CronPart<CronHoursValue>>

A CronHours or undefined if invalid.

Example

1
parseStringHours("10"); // 10
2
parseStringHours("*"); // "*"
3
parseStringHours("2/10"); // { every: 10, start: 2 }
4
parseStringHours("?/10"); // { every: 10, start: "?" }
5
parseStringHours("1,2,3,4"); // [1, 2, 3, 4]
6
parseStringHours("5-10"); // { from: 5, to: 10 }
7
parseStringHours("1,2,3,4,5-10"); // [1, 2, 3, 4, { from: 5, to: 10 }]
8
parseStringHours("INVALID"); // undefined
9
parseStringHours("1,2,3,4,INVALID"); // undefined

View source


parseStringHoursValue

parseStringHoursValue(input): Maybe<CronHoursValue>

Parses a string into a CronHoursValue.

Parameters

NameType
inputstring

Returns

Maybe<CronHoursValue>

A CronHoursValue or undefined if invalid.

Example

1
parseStringHoursValue("10"); // 10
2
parseStringHoursValue("25"); // undefined

View source


parseStringLastValue

parseStringLastValue(source): Maybe<CronLastValue>

Parses a string into a CronLastValue.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

Maybe<CronLastValue>

A CronLastValue or undefined if invalid.

Example

1
parseStringLastValue("5L"); // { last: 5 }
2
parseStringLastValue("INVALID"); // undefined

View source


parseStringList

parseStringList(limit): <Value>(parser: StringValueParser<Value>) => (source: string) => undefined | CronList<Value>

Parses a string into a CronList.

Parameters

NameTypeDescription
limitLimitTupleLimitTuple to be used when parsing CronSteps.

Returns

fn

Curried function with limit in context.

▸ <Value>(parser): (source: string) => undefined | CronList<Value>

Type parameters
Name
Value
Parameters
NameType
parserStringValueParser<Value>
Returns

fn

▸ (source): undefined | CronList<Value>

Parameters
NameType
sourcestring
Returns

undefined | CronList<Value>

Example

1
parseStringListSeconds("13,10"); // [13, 10]
2
parseStringListSeconds("13-10,10"); // [{ from: 13, to: 10 }, 10]
3
parseStringListSeconds("13/10,10"); // [{ every: 10, start: 13 }, 10]
4
parseStringListSeconds("13-10/10,10"); // [{ every: 10, start: { from: 13, to: 10 } }, 10]
5
parseStringListSeconds("?/10,10"); // [{ every: 10, start: "?" }, 10]
6
parseStringListSeconds("13,INVALID"); // undefined
7
parseStringListSeconds("INVALID"); // undefined

View source


parseStringMinutes

parseStringMinutes(source): Maybe<CronPart<CronMinutesValue>>

Parses a string into a CronMinutes.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

Maybe<CronPart<CronMinutesValue>>

A CronMinutes or undefined if invalid.

Example

1
parseStringMinutes("10"); // 10
2
parseStringMinutes("*"); // "*"
3
parseStringMinutes("2/10"); // { every: 10, start: 2 }
4
parseStringMinutes("?/10"); // { every: 10, start: "?" }
5
parseStringMinutes("1,2,3,4"); // [1, 2, 3, 4]
6
parseStringMinutes("5-10"); // { from: 5, to: 10 }
7
parseStringMinutes("1,2,3,4,5-10"); // [1, 2, 3, 4, { from: 5, to: 10 }]
8
parseStringMinutes("INVALID"); // undefined
9
parseStringMinutes("1,2,3,4,INVALID"); // undefined

View source


parseStringMinutesValue

parseStringMinutesValue(input): Maybe<CronMinutesValue>

Parses a string into a CronMinutesValue.

Parameters

NameType
inputstring

Returns

Maybe<CronMinutesValue>

A CronMinutesValue or undefined if invalid.

Example

1
parseStringMinutesValue("10"); // 10
2
parseStringMinutesValue("61"); // undefined

View source


parseStringMonth

parseStringMonth(source): Maybe<CronPart<CronMonthValue>>

Parses a string into a CronMonth.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

Maybe<CronPart<CronMonthValue>>

A CronMonth or undefined if invalid.

Example

1
parseStringMonth("10"); // 10
2
parseStringMonth("*"); // "*"
3
parseStringMonth("2/6"); // { every: 6, start: 2 }
4
parseStringMonth("?/6"); // { every: 6, start: "?" }
5
parseStringMonth("1,2,3,4"); // [1, 2, 3, 4]
6
parseStringMonth("1-5"); // { from: 1, to: 5 }
7
parseStringMonth("JAN-OCT"); // { from: "JAN", to: "OCT" }
8
parseStringMonth("jan-oct"); // { from: "JAN", to: "OCT" }
9
parseStringMonth("1,2,3,5-7"); // [1, 2, 3, { from: 5, to: 7 }]
10
parseStringMonth("INVALID"); // undefined
11
parseStringMonth("1,2,3,4,INVALID"); // undefined

View source


parseStringMonthValue

parseStringMonthValue(input): Maybe<CronMonthValue>

Parses a string into a CronMonthValue.

Parameters

NameType
inputstring

Returns

Maybe<CronMonthValue>

A CronMonthValue or undefined if invalid.

Example

1
parseStringMonthValue("10"); // 10
2
parseStringMonthValue("OCT"); // "OCT"
3
parseStringMonthValue("oct"); // "OCT"
4
parseStringMonthValue("24"); // undefined
5
parseStringMonthValue("IDK"); // undefined

View source


parseStringNearestDayOfMonth

parseStringNearestDayOfMonth(source): undefined | CronNearestDayOfMonth

Parses a string into a CronNearestDayOfMonth.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

undefined | CronNearestDayOfMonth

A CronNearestDayOfMonth or undefined if invalid.

Example

1
parseStringNearestDayOfMonth("2W"); // { nearest: 2 }
2
parseStringNearestDayOfMonth("INVALID"); // undefined

View source


parseStringPart

parseStringPart(limit): <Value>(parser: StringValueParser<Value>) => (source: string) => Maybe<CronPart<Value>>

Parses a string into a CronPart.

Parameters

NameTypeDescription
limitLimitTupleLimitTuple to be used when parsing CronSteps.

Returns

fn

Curried function with limit in context.

▸ <Value>(parser): (source: string) => Maybe<CronPart<Value>>

Type parameters
Name
Value
Parameters
NameType
parserStringValueParser<Value>
Returns

fn

▸ (source): Maybe<CronPart<Value>>

Parameters
NameType
sourcestring
Returns

Maybe<CronPart<Value>>

Example

1
const parseStringPartSeconds = parseStringPart([0, 59])(
2
parseStringSecondsValue,
3
);
4
5
parseStringPartSeconds("*"); // "*"
6
parseStringPartSeconds("13,10"); // [13, 10]
7
parseStringPartSeconds("13-10,10"); // [{ from: 13, to: 10 }, 10]
8
parseStringPartSeconds("13/10,10"); // [{ every: 10, start: 13 }, 10]
9
parseStringPartSeconds("?/10,10"); // [{ every: 10, start: "?" }, 10]
10
parseStringPartSeconds("13/10"); // { every: 10, start: 13 }
11
parseStringPartSeconds("?/10"); // { every: 10, start: "?" }
12
parseStringPartSeconds("13-10"); // { from: 13, to: 10 }

View source


parseStringQuartz

parseStringQuartz(source): Maybe<CronQuartz>

Parses a string into a CronQuartz.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

Maybe<CronQuartz>

A Cron or undefined if invalid.

Example

1
parseStringQuartz("* * * * * * *");
2
// {
3
// dayOfMonth: "*",
4
// dayOfWeek: "*",
5
// hours: "*",
6
// minutes: "*",
7
// month: "*",
8
// seconds: "*",
9
// year: "*",
10
// }
11
12
parseStringQuartz("* * * * *");
13
// {
14
// dayOfMonth: "*",
15
// dayOfWeek: "*",
16
// hours: "*",
17
// minutes: "*",
18
// month: "*",
19
// seconds: "*",
20
// year: "*",
21
// }
22
23
parseStringQuartz("1,2 1,2 1,2 1,2 1,2 1,2 1989,2020");
24
// {
25
// dayOfMonth: [1, 2],
26
// dayOfWeek: [1, 2],
27
// hours: [1, 2],
28
// minutes: [1, 2],
29
// month: [1, 2],
30
// seconds: [1, 2],
31
// year: [1989, 2020],
32
// }
33
34
parseStringQuartz("1-2 1-2 1-2 1-2 1-2 1-2 1989-2020");
35
// {
36
// dayOfMonth: { from: 1, to: 2 },
37
// dayOfWeek: { from: 1, to: 2 },
38
// hours: { from: 1, to: 2 },
39
// minutes: { from: 1, to: 2 },
40
// month: { from: 1, to: 2 },
41
// seconds: { from: 1, to: 2 },
42
// year: { from: 1989, to: 2020 },
43
// }
44
45
parseStringQuartz("1/2 1/2 1/2 1/2 1/2 1/2 1989/10");
46
// {
47
// dayOfMonth: { every: 2, start: 1 },
48
// dayOfWeek: { every: 2, start: 1 },
49
// hours: { every: 2, start: 1 },
50
// minutes: { every: 2, start: 1 },
51
// month: { every: 2, start: 1 },
52
// seconds: { every: 2, start: 1 },
53
// year: { every: 10, start: 1989 },
54
// }
55
56
parseStringQuartz("1-2/3 1-2,3,4 * 2W SEP,OCT 1L ?/10");
57
// {
58
// dayOfMonth: { nearest: 2 },
59
// dayOfWeek: { last: 1 },
60
// hours: "*",
61
// minutes: [{ from: 1, to: 2 }, 3, 4],
62
// month: ["SEP", "OCT"],
63
// seconds: { every: 3, start: { from: 1, to: 2 } },
64
// year: { every: 10, start: "?" },
65
// }
66
67
parseStringQuartz("INVALID"); // undefined

View source


parseStringQuartzExpression

parseStringQuartzExpression(source): undefined | readonly [string, string, string, string, string, string, string]

Parses given string expression.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

undefined | readonly [string, string, string, string, string, string, string]

An array of 7 elements or undefined if invalid.

Example

1
parseStringQuartzExpression("1 1 1 1 1"); // ["*", "1", "1", "1", "1", "1", "*"]
2
parseStringQuartzExpression("1 1 1 1 1 1989"); // ["*", "1", "1", "1", "1", "1", "1989"]
3
parseStringQuartzExpression("1 1 1 1 1 1"); // ["1", "1", "1", "1", "1", "1", "*"]
4
parseStringQuartzExpression("1 1 1 1 1 1 1"); // ["1", "1", "1", "1", "1", "1", "1"]
5
parseStringQuartzExpression(" 1 1 1 1 1 1 1 "); // ["1", "1", "1", "1", "1", "1", "1"]
6
parseStringQuartzExpression("1 1 1 1 1 1 1 1"); // undefined
7
parseStringQuartzExpression("1 1 1 1"); // undefined

View source


parseStringRange

parseStringRange<Value>(parser): (source: string) => Maybe<CronRange<Value>>

Parses a string into a CronRange.

Type parameters

Name
Value

Parameters

NameTypeDescription
parserStringValueParser<Value>StringValueParser for CronRange.

Returns

fn

Curried function with parser in context.

▸ (source): Maybe<CronRange<Value>>

Parameters
NameType
sourcestring
Returns

Maybe<CronRange<Value>>

Example

1
const parseStringRangeSeconds = parseStringRange(parseStringSecondsValue);
2
3
parseStringRangeSeconds("13-10"); // { from: 13, to: 10 }
4
parseStringRangeSeconds("INVALID"); // undefined

View source


parseStringSeconds

parseStringSeconds(source): Maybe<CronPart<CronSecondsValue>>

Parses a string into a CronSeconds.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

Maybe<CronPart<CronSecondsValue>>

A CronSeconds or undefined if invalid.

Example

1
parseStringSeconds("10"); // 10
2
parseStringSeconds("*"); // "*"
3
parseStringSeconds("2/10"); // { every: 10, start: 2 }
4
parseStringSeconds("?/10"); // { every: 10, start: "?" }
5
parseStringSeconds("1,2,3,4"); // [1, 2, 3, 4]
6
parseStringSeconds("5-10"); // { from: 5, to: 10 }
7
parseStringSeconds("1,2,3,4,5-10"); // [1, 2, 3, 4, { from: 5, to: 10 }]
8
parseStringSeconds("INVALID"); // undefined
9
parseStringSeconds("1,2,3,4,INVALID"); // undefined

View source


parseStringSecondsValue

parseStringSecondsValue(input): Maybe<CronSecondsValue>

Parses a string into a CronSecondsValue.

Parameters

NameType
inputstring

Returns

Maybe<CronSecondsValue>

A CronSecondsValue or undefined if invalid.

Example

1
parseStringSecondsValue("10"); // 10
2
parseStringSecondsValue("61"); // undefined

View source


parseStringSpecificDayOfWeek

parseStringSpecificDayOfWeek(source): Maybe<CronSpecificDayOfWeek>

Parses a string into a CronSpecificDayOfWeek.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

Maybe<CronSpecificDayOfWeek>

A CronSpecificDayOfWeek or undefined if invalid.

Example

1
parseStringSpecificDayOfWeek("1#5"); // { day: 1, week: 5 }
2
parseStringSpecificDayOfWeek("INVALID"); // undefined

View source


parseStringSteps

parseStringSteps(limit): <Value>(parser: StringValueParser<Value>) => (source: string) => Maybe<CronSteps<Value>>

Parses a string into a CronSteps.

Parameters

NameTypeDescription
limitLimitTupleLimitTuple for CronSteps.

Returns

fn

Curried function with limit in context.

▸ <Value>(parser): (source: string) => Maybe<CronSteps<Value>>

Type parameters
Name
Value
Parameters
NameType
parserStringValueParser<Value>
Returns

fn

▸ (source): Maybe<CronSteps<Value>>

Parameters
NameType
sourcestring
Returns

Maybe<CronSteps<Value>>

Example

1
const parseSecondsSteps = parseStringSteps([0, 59])(parseStringSecondsValue);
2
3
parseSecondsSteps("13/10"); // { every: 10, start: 13 }
4
parseSecondsSteps("13-10/10"); // { every: 10, start: { from: 13, to: 10 } }
5
parseSecondsSteps("?/10"); // { every: 10, start: "?" }
6
parseSecondsSteps("13"); // undefined

View source


parseStringUnix

parseStringUnix(source): Maybe<CronUnix>

Parses a string into a CronUnix.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

Maybe<CronUnix>

A CronUnix or undefined if invalid.

Example

1
parseStringUnix("* * * * *");
2
// {
3
// dayOfMonth: "*",
4
// dayOfWeek: "*",
5
// hours: "*",
6
// minutes: "*",
7
// month: "*",
8
// }
9
10
parseStringUnix("* * * * *");
11
// {
12
// dayOfMonth: "*",
13
// dayOfWeek: "*",
14
// hours: "*",
15
// minutes: "*",
16
// month: "*",
17
// }
18
19
parseStringUnix("1,2 1,2 1,2 1,2 1,2");
20
// {
21
// dayOfMonth: [1, 2],
22
// dayOfWeek: [1, 2],
23
// hours: [1, 2],
24
// minutes: [1, 2],
25
// month: [1, 2],
26
// }
27
28
parseStringUnix("1-2 1-2 1-2 1-2 1-2");
29
// {
30
// dayOfMonth: { from: 1, to: 2 },
31
// dayOfWeek: { from: 1, to: 2 },
32
// hours: { from: 1, to: 2 },
33
// minutes: { from: 1, to: 2 },
34
// month: { from: 1, to: 2 },
35
// }
36
37
parseStringUnix("1/2 1/2 1/2 1/2 1/2");
38
// {
39
// dayOfMonth: { every: 2, start: 1 },
40
// dayOfWeek: { every: 2, start: 1 },
41
// hours: { every: 2, start: 1 },
42
// minutes: { every: 2, start: 1 },
43
// month: { every: 2, start: 1 },
44
// }
45
46
parseStringUnix("1-2,3,4 * 2W SEP,OCT 1L");
47
// {
48
// dayOfMonth: { nearest: 2 },
49
// dayOfWeek: { last: 1 },
50
// hours: "*",
51
// minutes: [{ from: 1, to: 2 }, 3, 4],
52
// month: ["SEP", "OCT"],
53
// }
54
55
parseStringUnix("INVALID"); // undefined

View source


parseStringUnixExpression

parseStringUnixExpression(source): undefined | readonly [string, string, string, string, string]

Parses given expression or undefined if invalid.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

undefined | readonly [string, string, string, string, string]

An array of 5 elements or undefined if invalid.

Example

1
parseStringUnixExpression("1 1 1 1 1"); // ["1", "1", "1", "1", "1"]
2
parseStringUnixExpression(" 1 1 1 1 1 "); // ["1", "1", "1", "1", "1"]
3
parseStringUnixExpression("1 1 1 1 1 1"); // undefined
4
parseStringUnixExpression("1 1 1 1"); // undefined

View source


parseStringYear

parseStringYear(source): Maybe<CronPart<CronYearValue>>

Parses a string into a CronYear.

Parameters

NameTypeDescription
sourcestringstring to be parsed.

Returns

Maybe<CronPart<CronYearValue>>

A CronYear or undefined if invalid.

Example

1
parseStringYear("1989"); // 1989,
2
parseStringYear("*"); // "*",
3
parseStringYear("1989/10"); // { every: 10, start: 1989 },
4
parseStringYear("?/10"); // { every: 10, start: "?" },
5
parseStringYear("1989,1991,2015,2020"); // [1989, 1991, 2015, 2020],
6
parseStringYear("1989-2020"); // { from: 1989, to: 2020 },
7
parseStringYear("1989,1991,2015,2020,1989-2020"); // [1989, 1991, 2015, 2020, { from: 1989, to: 2020 }],
8
parseStringYear("INVALID"); // undefined,
9
parseStringYear("1,2,3,4,INVALID"); // undefined,

View source


parseStringYearValue

parseStringYearValue(input): Maybe<CronYearValue>

Parses a string into a CronYearValue.

Parameters

NameType
inputstring

Returns

Maybe<CronYearValue>

A CronYearValue or undefined if invalid.

Example

1
parseStringYearValue("1989"); // 1989
2
parseStringYearValue("3000"); // undefined

View source

Predicates

isCronDayOfMonthValue

isCronDayOfMonthValue(value): value is CronDayOfMonthValue

Check if given is CronDayOfMonthValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronDayOfMonthValue

Returns true if is CronDayOfMonthValue, false otherwise.

Example

1
isCronDayOfMonthValue(13); // true
2
isCronDayOfMonthValue(50); // false

View source


isCronDayOfWeekValue

isCronDayOfWeekValue(value): value is CronDayOfWeekValue

Check if given is CronDayOfWeekValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronDayOfWeekValue

Returns true if is CronDayOfWeekValue, false otherwise.

Example

1
isCronDayOfWeekValue(5); // true
2
isCronDayOfWeekValue("FRI"); // true
3
isCronDayOfWeekValue("fri"); // true
4
isCronDayOfWeekValue("FRIDAY"); // false
5
isCronDayOfWeekValue(10); // false
6
isCronDayOfWeekValue("INVALID"); // false

View source


isCronDayOfWeekValueNumber

isCronDayOfWeekValueNumber(value): value is CronDayOfWeekValueNumber

Check if given is CronDayOfWeekValueNumber.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronDayOfWeekValueNumber

Returns true if is CronDayOfWeekValueNumber, false otherwise.

Example

1
isCronDayOfWeekValueNumber(5); // true
2
isCronDayOfWeekValueNumber(10); // false
3
isCronDayOfWeekValueNumber("INVALID"); // false

View source


isCronDayOfWeekValueString

isCronDayOfWeekValueString(value): value is CronDayOfWeekValueString

Check if given is CronDayOfWeekValueString.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronDayOfWeekValueString

Returns true if is CronDayOfWeekValueString, false otherwise.

Example

1
isCronDayOfWeekValueString("FRI"); // true
2
isCronDayOfWeekValueString("fri"); // true
3
isCronDayOfWeekValueString("FRIDAY"); // false

View source


isCronEvery

isCronEvery(value): value is ”*“

Check if given is CronEvery.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is ”*“

Returns true if is CronEvery, false otherwise.

Example

1
isCronEvery("*"); // true
2
isCronEvery("INVALID"); // false

View source


isCronHoursValue

isCronHoursValue(value): value is CronHoursValue

Check if given is CronHoursValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronHoursValue

Returns true if is CronHoursValue, false otherwise.

Example

1
isCronHoursValue(12); // true
2
isCronHoursValue(50); // false

View source


isCronLast

isCronLast(value): value is “L”

Check if given is CronLast.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is “L”

Returns true if is CronLast, false otherwise.

Example

1
isCronLast("L"); // true
2
isCronLast("INVALID"); // false

View source


isCronLastValue

isCronLastValue(value): value is CronLastValue

Check if given is CronLastValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronLastValue

Returns true if is CronLastValue, false otherwise.

Example

1
isCronLastValue({ last: 7 }); // true
2
isCronLastValue({ last: 100 }); // false

View source


isCronList

isCronList<Value>(value): value is CronList<Value>

Check if given is CronList.

Type parameters

Name
Value

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronList<Value>

Returns true if is CronList, false otherwise.

Example

1
isCronList(["value", "value", "value"]); // true

View source


isCronMinutesValue

isCronMinutesValue(value): value is CronMinutesValue

Check if given is CronMinutesValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronMinutesValue

Returns true if is CronMinutesValue, false otherwise.

Example

1
isCronMinutesValue(30); // true
2
isCronMinutesValue(80); // false

View source


isCronMonthValue

isCronMonthValue(value): value is CronMonthValue

Check if given is CronMonthValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronMonthValue

Returns true if is CronMonthValue, false otherwise.

Example

1
isCronMonthValue(10); // true
2
isCronMonthValue("OCT"); // true
3
isCronMonthValue("oct"); // true
4
isCronMonthValue("OCTOBER"); // false
5
isCronMonthValue(50); // false
6
isCronMonthValue("INVALID"); // false

View source


isCronMonthValueNumber

isCronMonthValueNumber(value): value is CronMonthValueNumber

Check if given is CronMonthValueNumber.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronMonthValueNumber

Returns true if is CronMonthValueNumber, false otherwise.

Example

1
isCronMonthValueNumber(10); // true
2
isCronMonthValueNumber(50); // false

View source


isCronMonthValueString

isCronMonthValueString(value): value is CronMonthValueString

Check if given is CronMonthValueString.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronMonthValueString

Returns true if is CronMonthValueString, false otherwise.

Example

1
isCronMonthValueString("OCT"); // true
2
isCronMonthValueString("oct"); // true
3
isCronMonthValueString("INVALID"); // false

View source


isCronNearestDayOfMonth

isCronNearestDayOfMonth(value): value is CronNearestDayOfMonth

Check if given is CronNearestDayOfMonth.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronNearestDayOfMonth

Returns true if is CronNearestDayOfMonth, false otherwise.

Example

1
isCronNearestDayOfMonth({ nearest: 10 }); // true
2
isCronNearestDayOfMonth({ nearest: 100 }); // false

View source


isCronRange

isCronRange<Value>(value): value is CronRange<Value>

Check if given is CronRange.

Type parameters

Name
Value

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronRange<Value>

Returns true if is CronRange, false otherwise.

Example

1
isCronRange({ from: 10, to: 20 }); // true
2
isCronRange({}); // false

View source


isCronSpecificDayOfWeek

isCronSpecificDayOfWeek(value): value is CronSpecificDayOfWeek

Check if given is CronSpecificDayOfWeek.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronSpecificDayOfWeek

Returns true if is CronSpecificDayOfWeek, false otherwise.

Example

1
isCronSpecificDayOfWeek({ day: 1, week: 5 }); // true
2
isCronSpecificDayOfWeek({ day: 9, week: 9 }); // false

View source


isCronStartOrBlank

isCronStartOrBlank(value): value is ”?”

Check if given is CronStartOrBlank.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is ”?”

Returns true if is CronStartOrBlank, false otherwise.

Example

1
isCronStartOrBlank("?"); // true
2
isCronStartOrBlank("INVALID"); // false

View source


isCronSteps

isCronSteps<Value>(value): value is CronSteps<Value>

Check if given is CronSteps.

Type parameters

Name
Value

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronSteps<Value>

Returns true if is CronSteps, false otherwise.

Example

1
isCronSteps({ every: 10, start: "value" }); // true
2
isCronSteps({ every: "invalid" }); // false

View source


isCronWeekValue

isCronWeekValue(value): value is CronWeekValue

Check if given is CronWeekValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronWeekValue

Returns true if is CronWeekValue, false otherwise.

Example

1
isCronWeekValue(2); // true
2
isCronWeekValue(8); // false

View source


isCronYearValue

isCronYearValue(value): value is CronYearValue

Check if given is CronYearValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is CronYearValue

Returns true if is CronYearValue, false otherwise.

Example

1
isCronYearValue(1989); // true
2
isCronYearValue(3000); // false

View source


isStringDayOfMonthValue

isStringDayOfMonthValue(value): value is string

Check if given is a string representing a CronDayOfMonthValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronDayOfMonthValue, false otherwise.

Example

1
isStringDayOfMonthValue("13"); // true
2
isStringDayOfMonthValue("50"); // false

View source


isStringDayOfWeekValue

isStringDayOfWeekValue(value): boolean

Check if given is a string representing a CronDayOfWeekValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

boolean

Returns true if is a string representing a CronDayOfWeekValue, false otherwise.

Example

1
isStringDayOfWeekValue("5"); // true
2
isStringDayOfWeekValue("FRI"); // true
3
isStringDayOfWeekValue("fri"); // true
4
isStringDayOfWeekValue("FRIDAY"); // false
5
isStringDayOfWeekValue("10"); // false
6
isStringDayOfWeekValue("INVALID"); // false

View source


isStringDayOfWeekValueNumber

isStringDayOfWeekValueNumber(value): value is string

Check if given is a string representing a CronDayOfWeekValueNumber.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronDayOfWeekValueNumber, false otherwise.

Example

1
isStringDayOfWeekValueNumber("5"); // true
2
isStringDayOfWeekValueNumber("10"); // false

View source


isStringHoursValue

isStringHoursValue(value): value is string

Check if given is a string representing a CronHoursValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronHoursValue, false otherwise.

Example

1
isStringHoursValue("12"); // true
2
isStringHoursValue("50"); // false

View source


isStringLastValue

isStringLastValue(value): value is string

Check if given is a string representing a CronLastValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronLastValue, false otherwise.

Example

1
isStringLastValue("7L"); // true
2
isStringLastValue("7l"); // true
3
isStringLastValue("100L"); // false
4
isStringLastValue("INVALID"); // false

View source


isStringList

isStringList(value): value is string

Check if given is a string representing a CronList.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronList, false otherwise.

Example

1
isStringList("value,value,value"); // true
2
isStringList("value"); // false

View source


isStringMinutesValue

isStringMinutesValue(value): value is string

Check if given is a string representing a CronMinutesValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronMinutesValue, false otherwise.

Example

1
isStringMinutesValue("30"); // true
2
isStringMinutesValue("80"); // false

View source


isStringMonthValue

isStringMonthValue(value): boolean

Check if given is a string representing a CronMonthValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

boolean

Returns true if is a string representing a CronMonthValue, false otherwise.

Example

1
isStringMonthValue("10"); // true
2
isStringMonthValue("OCT"); // true
3
isStringMonthValue("oct"); // true
4
isStringMonthValue("OCTOBER"); // false
5
isStringMonthValue("50"); // false
6
isStringMonthValue("INVALID"); // false

View source


isStringMonthValueNumber

isStringMonthValueNumber(value): value is string

Check if given is a string representing a CronMonthValueNumber.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronMonthValueNumber, false otherwise.

Example

1
isStringMonthValueNumber("10"); // true
2
isStringMonthValueNumber("50"); // false

View source


isStringNearestDayOfMonth

isStringNearestDayOfMonth(value): value is string

Check if given is a string representing a CronNearestDayOfMonth.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronNearestDayOfMonth, false otherwise.

Example

1
isStringNearestDayOfMonth("10W"); // true
2
isStringNearestDayOfMonth("10w"); // true
3
isStringNearestDayOfMonth("100w"); // false
4
isStringNearestDayOfMonth("INVALID"); // false

View source


isStringRange

isStringRange(value): value is string

Check if given is a string representing a CronRange.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronRange, false otherwise.

Example

1
isStringRange("10-20"); // true
2
isStringRange("13-10-1989"); // false
3
isStringRange("value"); // false

View source


isStringSecondsValue

isStringSecondsValue(value): value is string

Check if given is a string representing a CronSecondsValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronSecondsValue, false otherwise.

Example

1
isStringSecondsValue("30"); // true
2
isStringSecondsValue("80"); // false

View source


isStringSpecificDayOfWeek

isStringSpecificDayOfWeek(value): value is string

Check if given is a string representing a CronSpecificDayOfWeek.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronSpecificDayOfWeek, false otherwise.

Example

1
isStringSpecificDayOfWeek("1#5"); // true
2
isStringSpecificDayOfWeek("9#9"); // false

View source


isStringSteps

isStringSteps(value): value is string

Check if given is a string representing a CronSteps.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronSteps, false otherwise.

Example

1
isStringSteps("value/value"); // true
2
isStringSteps("value/value/value"); // false
3
isStringSteps("value"); // false

View source


isStringWeekValue

isStringWeekValue(value): value is string

Check if given is a string representing a CronWeekValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronWeekValue, false otherwise.

Example

1
isStringWeekValue("2"); // true
2
isStringWeekValue("8"); // false

View source


isStringYearValue

isStringYearValue(value): value is string

Check if given is a string representing a CronYearValue.

Parameters

NameTypeDescription
valueunknownValue to check.

Returns

value is string

Returns true if is a string representing a CronYearValue, false otherwise.

Example

1
isStringYearValue("1989"); // true
2
isStringYearValue("3000"); // false

View source


stringIncludesOnlyOnce

stringIncludesOnlyOnce(search): (value: unknown) => value is string

Checks if given search value appears just onces in given value.

Parameters

NameTypeDescription
searchstringValue to search.

Returns

fn

Curried function with search in context.

▸ (value): value is string

Parameters
NameType
valueunknown
Returns

value is string

Example

1
const includesCommaOnce = stringIncludesOnlyOnce(",");
2
includesCommaOnce("value,value"); // true
3
includesCommaOnce("value,value,value"); // false
4
includesCommaOnce("value"); // false

View source