cron-parser
Version:
Node.js library for parsing crontab instructions
44 lines (43 loc) • 1.25 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.CronDayOfWeek = void 0;
const CronField_1 = require("./CronField");
const MIN_DAY = 0;
const MAX_DAY = 7;
const DAY_CHARS = Object.freeze(['L']);
/**
* Represents the "day of the week" field within a cron expression.
* @class CronDayOfTheWeek
* @extends CronField
*/
class CronDayOfWeek 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#/-]+$/;
}
/**
* CronDayOfTheWeek constructor. Initializes the "day of the week" field with the provided values.
* @param {DayOfWeekRange[]} values - Values for the "day of the week" field
* @param {boolean} [wildcard=false] - Whether this field is a wildcard
*/
constructor(values, wildcard = false) {
super(values, wildcard);
this.validate();
}
/**
* Returns an array of allowed values for the "day of the week" field.
* @returns {DayOfWeekRange[]}
*/
get values() {
return super.values;
}
}
exports.CronDayOfWeek = CronDayOfWeek;
;