UNPKG

cron-parser

Version:

Node.js library for parsing crontab instructions

45 lines (44 loc) 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CronDayOfMonth = void 0; const CronField_1 = require("./CronField"); const MIN_DAY = 1; const MAX_DAY = 31; const DAY_CHARS = Object.freeze(['L']); /** * Represents the "day of the month" field within a cron expression. * @class CronDayOfMonth * @extends CronField */ class CronDayOfMonth extends CronField_1.CronField { static get min() { return MIN_DAY; } static get max() { return MAX_DAY; } static get chars() { return DAY_CHARS; } static get validChars() { return /^[?,*\dL/-]+$/; } /** * CronDayOfMonth constructor. Initializes the "day of the month" field with the provided values. * @param {DayOfMonthRange[]} values - Values for the "day of the month" field * @param {boolean} [wildcard=false] - Whether this field is a wildcard * @throws {Error} if validation fails */ constructor(values, wildcard = false) { super(values, wildcard); this.validate(); } /** * Returns an array of allowed values for the "day of the month" field. * @returns {DayOfMonthRange[]} */ get values() { return super.values; } } exports.CronDayOfMonth = CronDayOfMonth;