@drewsonne/maya-dates
Version:
Typescript package to manipulate dates in the Maya Calendar
44 lines • 1.64 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var wildcardCoefficient_1 = __importDefault(require("./wildcardCoefficient"));
var NumberCoefficient = (function () {
function NumberCoefficient(coefficient) {
this.value = coefficient;
}
NumberCoefficient.prototype.isWildcard = function () {
return false;
};
NumberCoefficient.prototype.validate = function () {
return true;
};
NumberCoefficient.prototype.increment = function () {
return new NumberCoefficient(this.value + 1);
};
NumberCoefficient.prototype.isIn = function (validHaabCoeffs) {
return validHaabCoeffs.includes(this.value);
};
NumberCoefficient.prototype.toString = function () {
return "".concat(this.value);
};
NumberCoefficient.prototype.equal = function (coefficient) {
if (coefficient instanceof wildcardCoefficient_1.default) {
return false;
}
return "".concat(this) === "".concat(coefficient);
};
NumberCoefficient.prototype.match = function (coefficient) {
if (coefficient instanceof wildcardCoefficient_1.default) {
return true;
}
if (coefficient instanceof NumberCoefficient) {
return this.value == coefficient.value;
}
throw new Error("Unexpected coefficient type");
};
return NumberCoefficient;
}());
exports.default = NumberCoefficient;
//# sourceMappingURL=numberCoefficient.js.map