diff --git a/fields.js b/fields.js index 9890898..9e0af38 100644 --- a/fields.js +++ b/fields.js @@ -57,21 +57,7 @@ class FieldsContainer { } } -class StringField { - set transitType(v) { - if (schema.isValid(v, schema.constants.transitType, true)) { - this.fields = v; - } else { - this.fields = this.fields && this.fields !== "" ? this.fields : ""; - } - } - get transitType() { - return this.fields; - } -} - module.exports = { areas: ["primaryFields", "secondaryFields", "auxiliaryFields", "backFields", "headerFields"], - FieldsContainer, - StringField + FieldsContainer }; diff --git a/index.js b/index.js index 2cd96e5..35f2a84 100644 --- a/index.js +++ b/index.js @@ -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; + } } /**