mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 22:25:24 +00:00
Added more validation checks
This commit is contained in:
15
index.js
15
index.js
@@ -390,7 +390,11 @@ class Pass {
|
|||||||
|
|
||||||
barcode(data) {
|
barcode(data) {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return 0;
|
return Object.assign({
|
||||||
|
length: 0,
|
||||||
|
autocomplete: () => {},
|
||||||
|
backward: () => {}
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof data === "string" || (data instanceof Object && !data.format && data.message)) {
|
if (typeof data === "string" || (data instanceof Object && !data.format && data.message)) {
|
||||||
@@ -440,8 +444,11 @@ class Pass {
|
|||||||
__barcodeAutocomplete() {
|
__barcodeAutocomplete() {
|
||||||
let props = this.props["barcodes"];
|
let props = this.props["barcodes"];
|
||||||
|
|
||||||
if (props.length === 4) {
|
if (props.length === 4 || !props.length) {
|
||||||
return 0;
|
return Object.assign({
|
||||||
|
length: 0,
|
||||||
|
backward: () => {}
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
let usedFormats = props.map(p => p.format);
|
let usedFormats = props.map(p => p.format);
|
||||||
@@ -509,7 +516,7 @@ class Pass {
|
|||||||
messageEncoding: data.messageEncoding || "iso-8859-1"
|
messageEncoding: data.messageEncoding || "iso-8859-1"
|
||||||
};
|
};
|
||||||
|
|
||||||
return types.map(T => (Object.assign({ format: T }, source)))
|
return types.map(T => (Object.assign({ format: T }, source)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user