index.d.ts
2.29 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
export = CronParser
declare class CronDate {
addYear(): void
addMonth(): void
addDay(): void
addHour(): void
addMinute(): void
addSecond(): void
subtractYear(): void
subtractMonth(): void
subtractDay(): void
subtractHour(): void
subtractMinute(): void
subtractSecond(): void
getDate(): number
getFullYear(): number
getDay(): number
getMonth(): number
getHours(): number
getMinutes(): number
getSeconds(): number
getMilliseconds(): number
getTime(): number
getUTCDate(): number
getUTCFullYear(): number
getUTCDay(): number
getUTCMonth(): number
getUTCHours(): number
getUTCMinutes(): number
getUTCSeconds(): number
toISOString(): string
toJSON(): string
setDate(d: number): void
setFullYear(y: number): void
setDay(d: number): void
setMonth(m: number): void
setHours(h: number): void
setMinutes(m: number): void
setSeconds(s: number): void
setMilliseconds(s: number): void
getTime(): number
toString(): string
toDate(): Date
}
interface ParserOptions {
currentDate?: string | number | Date
startDate?: string | number | Date
endDate?: string | number | Date
iterator?: boolean
utc?: boolean
tz?: string
}
declare class CronExpression {
constructor(fields: {}, options: {})
/** Find next suitable date */
next(): CronDate
/** Find previous suitable date */
prev(): CronDate
/** Check if next suitable date exists */
hasNext(): boolean
/** Check if previous suitable date exists */
hasPrev(): boolean
/** Iterate over expression iterator */
iterate(steps: number, callback?: (item: CronDate, i: number) => any): CronDate[]
/** Reset expression iterator state */
reset(): void
/** Parse input expression (async) */
parse(expression: string, options?: ParserOptions, callback?: () => any): CronExpression
}
interface StringResult {
variables: { [key: string]: string },
expressions: CronExpression[],
errors: { [key: string]: string }
}
declare namespace CronParser {
/** Wrapper for CronExpression.parse method */
function parseExpression(expression: string, options?: ParserOptions): CronExpression
/** Parse crontab file */
function parseFile(filePath: string, callback: (err: any, data: StringResult) => any): void
/** Parse content string */
function parseString(data: string): StringResult
}