mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 18:25:24 +00:00
Added debug for barcode methods
This commit is contained in:
4
index.js
4
index.js
@@ -6,6 +6,7 @@ const forge = require("node-forge");
|
|||||||
const archiver = require("archiver");
|
const archiver = require("archiver");
|
||||||
const moment = require("moment");
|
const moment = require("moment");
|
||||||
const schema = require("./schema");
|
const schema = require("./schema");
|
||||||
|
const barcodeDebug = require("debug")("passkit:barcode");
|
||||||
const { areas: fieldsName, FieldsContainer } = require("./fields");
|
const { areas: fieldsName, FieldsContainer } = require("./fields");
|
||||||
const { errors, warnings } = require("./messages");
|
const { errors, warnings } = require("./messages");
|
||||||
|
|
||||||
@@ -328,6 +329,7 @@ class Pass {
|
|||||||
|
|
||||||
__barcodeAutogen(data) {
|
__barcodeAutogen(data) {
|
||||||
if (!data || !(data instanceof Object) || !data.message) {
|
if (!data || !(data instanceof Object) || !data.message) {
|
||||||
|
barcodeDebug("Unable to autogenerate barcodes. Data is not an object or has not message field.");
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,12 +386,14 @@ class Pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof format !== "string") {
|
if (typeof format !== "string") {
|
||||||
|
barcodeDebug("format must be a string or null. Cannot set backward compatibility.");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
let index = this.props["barcodes"].findIndex(b => b.format.toLowerCase().includes(format.toLowerCase()));
|
let index = this.props["barcodes"].findIndex(b => b.format.toLowerCase().includes(format.toLowerCase()));
|
||||||
|
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
|
barcodeDebug("format not found among barcodes. Cannot set backward compatibility.");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user