2018-07-10 12:20:53 +00:00
|
|
|
"use strict";
|
2018-07-10 19:29:09 +02:00
|
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
};
|
2018-07-10 12:20:53 +00:00
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2018-07-10 19:29:09 +02:00
|
|
|
var part_1 = __importDefault(require("./part"));
|
|
|
|
var option_1 = __importDefault(require("./option"));
|
2018-07-10 12:20:53 +00:00
|
|
|
var Pattern = /** @class */ (function () {
|
|
|
|
function Pattern(config) {
|
|
|
|
this.config = config;
|
2018-07-10 19:29:09 +02:00
|
|
|
this.parts = {};
|
|
|
|
for (var _i = 0, _a = config.parts; _i < _a.length; _i++) {
|
|
|
|
var id = _a[_i];
|
|
|
|
this.parts[id] = new part_1.default(id);
|
|
|
|
}
|
|
|
|
this.options = {};
|
|
|
|
for (var _b = 0, _c = config.options; _b < _c.length; _b++) {
|
|
|
|
var conf = _c[_b];
|
|
|
|
this.options[conf.id] = new option_1.default(conf);
|
|
|
|
}
|
2018-07-10 12:20:53 +00:00
|
|
|
return this;
|
|
|
|
}
|
2018-07-10 19:29:09 +02:00
|
|
|
Pattern.prototype.draft = function (config) {
|
|
|
|
throw Error('You have to implement the draft() method in your Pattern instance.');
|
|
|
|
};
|
2018-07-11 12:45:02 +00:00
|
|
|
Pattern.prototype.getOption = function (id) {
|
|
|
|
return this.options[id].val;
|
|
|
|
};
|
|
|
|
Pattern.prototype.o = function (id) {
|
|
|
|
return this.getOption(id);
|
|
|
|
};
|
2018-07-10 12:20:53 +00:00
|
|
|
return Pattern;
|
|
|
|
}());
|
|
|
|
exports.default = Pattern;
|