mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 13:25:19 +00:00
Fixed possible undefined date case
This commit is contained in:
@@ -1201,8 +1201,12 @@ function validateJSONBuffer(
|
|||||||
function isRelevantEntry(
|
function isRelevantEntry(
|
||||||
entry: Schemas.RelevantDate,
|
entry: Schemas.RelevantDate,
|
||||||
): entry is Schemas.RelevancyEntry {
|
): entry is Schemas.RelevancyEntry {
|
||||||
return (
|
const isRelevantDateAvailable: boolean =
|
||||||
Object.prototype.hasOwnProperty.call(entry, "relevantDate") ||
|
Object.prototype.hasOwnProperty.call(entry, "relevantDate") &&
|
||||||
Object.prototype.hasOwnProperty.call(entry, "date")
|
"relevantDate" in entry;
|
||||||
);
|
|
||||||
|
const isDateAvailable: boolean =
|
||||||
|
Object.prototype.hasOwnProperty.call(entry, "date") && "date" in entry;
|
||||||
|
|
||||||
|
return isRelevantDateAvailable || isDateAvailable;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user