Fixed nfc methods which was accepting and registering an array instead of an object

This commit is contained in:
Alexander Cerutti
2019-06-05 22:09:20 +02:00
parent 8d8db830dd
commit 6451a3c378

View File

@@ -483,20 +483,17 @@ class Pass {
* Sets nfc fields in properties * Sets nfc fields in properties
* *
* @method nfc * @method nfc
* @params {Array<Object>} data - the data to be pushed in the pass * @params {Object} data - the data to be pushed in the pass
* @returns {this} * @returns {this}
*/ */
nfc(...data) { nfc(data) {
if (data.length === 1 && data[0] instanceof Array) { if (!(typeof data === "object" && !Array.isArray(data) && schema.isValid(data, "nfcDict"))) {
data = data[0]; genericDebug("Invalid NFC data provided");
return this;
} }
let valid = data.filter(d => d instanceof Object && schema.isValid(d, "nfcDict")); this._props["nfc"] = data;
if (valid.length) {
this._props["nfc"] = valid;
}
return this; return this;
} }