mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 18:25:24 +00:00
Moved to index.js getter and setter of transitType; Removed from fields.js the class created specifically
This commit is contained in:
16
fields.js
16
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
|
||||
};
|
||||
|
||||
16
index.js
16
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user