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
*
* @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}
*/
nfc(...data) {
if (data.length === 1 && data[0] instanceof Array) {
data = data[0];
nfc(data) {
if (!(typeof data === "object" && !Array.isArray(data) && schema.isValid(data, "nfcDict"))) {
genericDebug("Invalid NFC data provided");
return this;
}
let valid = data.filter(d => d instanceof Object && schema.isValid(d, "nfcDict"));
if (valid.length) {
this._props["nfc"] = valid;
}
this._props["nfc"] = data;
return this;
}