Moved to index.js getter and setter of transitType; Removed from fields.js the class created specifically

This commit is contained in:
alexandercerutti
2018-08-27 00:23:58 +02:00
parent 3c56659697
commit 5b533c8d00
2 changed files with 15 additions and 17 deletions

View File

@@ -6,7 +6,7 @@ const forge = require("node-forge");
const archiver = require("archiver");
const moment = require("moment");
const schema = require("./schema");
const { areas: fieldsName, FieldsContainer, StringField } = require("./fields");
const { areas: fieldsName, FieldsContainer } = require("./fields");
const { errors, warnings } = require("./messages");
const readdir = util.promisify(fs.readdir);
@@ -22,7 +22,7 @@ class Pass {
this.shouldOverwrite = !(this.options.hasOwnProperty("shouldOverwrite") && !this.options.shouldOverwrite);
fieldsName.forEach(a => this[a] = new FieldsContainer());
this.transitType = new StringField();
this._transitType = "";
}
/**
@@ -609,6 +609,18 @@ class Pass {
throw new Error(errors.INVALID_CERTS);
});
}
set transitType(v) {
if (schema.isValid(v, schema.constants.transitType)) {
this._transitType = v;
} else {
this._transitType = this._transitType || "";
}
}
get transitType() {
return this._transitType;
}
}
/**