mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 19:25:23 +00:00
Fixed nfc methods which was accepting and registering an array instead of an object
This commit is contained in:
15
src/pass.js
15
src/pass.js
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user