From be9cf53a8ad68348fffcd40f364ee5f86503e9d8 Mon Sep 17 00:00:00 2001 From: Kai Volland Date: Mon, 5 Sep 2022 11:22:38 +0200 Subject: [PATCH] make function typeguards more failsafe --- typeguards.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/typeguards.ts b/typeguards.ts index a16c285a2..792e2a25d 100644 --- a/typeguards.ts +++ b/typeguards.ts @@ -192,7 +192,7 @@ export const isGeoStylerNumberFunction = (got: any): got is GeoStylerNumberFunct 'tan', 'toDegrees', 'toRadians' - ].includes(got.name); + ].includes(got?.name); }; export const isGeoStylerStringFunction = (got: any): got is GeoStylerStringFunction => { @@ -209,7 +209,7 @@ export const isGeoStylerStringFunction = (got: any): got is GeoStylerStringFunct 'strToLowerCase', 'strToUpperCase', 'strTrim' - ].includes(got.name); + ].includes(got?.name); }; export const isGeoStylerBooleanFunction = (got: any): got is GeoStylerBooleanFunction => { @@ -222,13 +222,13 @@ export const isGeoStylerBooleanFunction = (got: any): got is GeoStylerBooleanFun 'strEqualsIgnoreCase', 'strMatches', 'strStartsWith' - ].includes(got.name); + ].includes(got?.name); }; export const isGeoStylerUnknownFunction = (got: any): got is GeoStylerUnknownFunction => { return [ 'property', - ].includes(got.name); + ].includes(got?.name); }; export const isGeoStylerFunction = (got: any): got is GeoStylerFunction => {