From f0d83b46d1abd331ab293ef1d86710481d2fbddc Mon Sep 17 00:00:00 2001 From: busma13 Date: Fri, 27 Sep 2024 10:50:11 -0700 Subject: [PATCH] only check for null or undefined --- .../data-mate/src/document-matcher/logic-builder/ip.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/data-mate/src/document-matcher/logic-builder/ip.ts b/packages/data-mate/src/document-matcher/logic-builder/ip.ts index 79f4c774d31..d2d91e237d4 100644 --- a/packages/data-mate/src/document-matcher/logic-builder/ip.ts +++ b/packages/data-mate/src/document-matcher/logic-builder/ip.ts @@ -88,12 +88,12 @@ function checkCidr(ip: string, range: any) { } function pRangeTerm(range: any) { - return function checkIP(ip: any) { - if (typeof ip !== 'string') return false; - if (isNonZeroCidr(ip)) { - return checkCidr(ip, range); + return function checkIP(ip: unknown) { + if (ip === null || ip === undefined) return false; + if (isNonZeroCidr(ip as any)) { + return checkCidr(ip as any, range); } - if (isIP(ip)) return range.contains(ip); + if (isIP(ip as any)) return range.contains(ip); return false; }; }