mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 16:25:21 +00:00
Improved check for maxDistance, to check if the converted value is NaN
This commit is contained in:
12
index.js
12
index.js
@@ -256,10 +256,16 @@ class Pass {
|
||||
}
|
||||
|
||||
if (type === "maxDistance" && (typeof data === "string" || typeof data === "number")) {
|
||||
this.props[type] = Number(data);
|
||||
let conv = Number(data);
|
||||
// condition to proceed
|
||||
let cond = isNaN(conv);
|
||||
|
||||
if (!cond) {
|
||||
this.props[type] = conv;
|
||||
}
|
||||
|
||||
return Object.assign({
|
||||
length: 1
|
||||
length: Number(!cond)
|
||||
}, this);
|
||||
} else if (type === "relevantDate") {
|
||||
let dateParse = dateToW3CString(data);
|
||||
@@ -271,7 +277,7 @@ class Pass {
|
||||
}
|
||||
|
||||
return Object.assign({
|
||||
length: Number(!!convDate)
|
||||
length: Number(!!dateParse)
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user