UNPKG

natural-cron

Version:

Natural Cron is a easy-to-use Node.js library for creating and validating cron expressions with natural, human-readable APIs.

45 lines (44 loc) 2.05 kB
export declare class CronValidators { /** * Validates if the given minute is within the cron range of 0 to 59. * @param {number} minute - The minute value to validate. * @throws Will throw an error if the minute is not within the range of 0 to 59. */ static validateMinute(minute: number): void; /** * Validates if the given hour is within the cron range of 0 to 23. * @param {number} hour - The hour value to validate. * @throws Will throw an error if the hour is not within the range of 0 to 23. */ static validateHour(hour: number): void; /** * Validates if the given day of the month is within the cron range of 1 to 31. * @param {number} day - The day of the month to validate. * @throws Will throw an error if the day is not within the range of 1 to 31. */ static validateDayOfMonth(day: number): void; /** * Validates if the given month is within the cron range of 1 to 12. * @param {number} month - The month value to validate. * @throws Will throw an error if the month is not within the range of 1 to 12. */ static validateMonth(month: number): void; /** * Validates if the given day of the week is within the cron range of 0 (Sunday) to 6 (Saturday). * @param {number} day - The day of the week to validate. * @throws Will throw an error if the day is not within the range of 0 to 6. */ static validateDayOfWeek(day: number): void; /** * Validates the format of a cron time string. * @param {string} time - The time string to validate in HH:MM format. * @throws Will throw an error if the time format does not match HH:MM. */ static validateTime(time: string): void; /** * Validates if the given time unit is a valid cron time unit. * @param {string} unit - The time unit to validate (e.g., 'minute', 'hour', etc.). * @throws Will throw an error if the unit is not a valid cron time unit. */ static validateTimeUnit(unit: string): void; }