From 753317e9ca46c69809de832fb9d6cb1fc09e18e0 Mon Sep 17 00:00:00 2001 From: Rhys Howell Date: Mon, 4 Dec 2023 23:40:31 -0500 Subject: [PATCH] use has own property --- src/scope.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scope.ts b/src/scope.ts index be6de51..45efc7b 100644 --- a/src/scope.ts +++ b/src/scope.ts @@ -234,7 +234,7 @@ export function getScopeFunction(key: string, withNew: boolean): Function { } export function isMethodWhitelisted(member: string, property: string): boolean { - if (ALLOWED_CLASS_EXPRESSIONS[member]) { + if (ALLOWED_CLASS_EXPRESSIONS.hasOwnProperty(member)) { const allowedMethods = ALLOWED_CLASS_EXPRESSIONS[member].allowedMethods; if (typeof allowedMethods === 'string') { @@ -248,7 +248,7 @@ export function isMethodWhitelisted(member: string, property: string): boolean { } export function getClass(member: string) { - if (ALLOWED_CLASS_EXPRESSIONS[member]) { + if (ALLOWED_CLASS_EXPRESSIONS.hasOwnProperty(member)) { return ALLOWED_CLASS_EXPRESSIONS[member].class; } throw new Error(`Attempted to access member '${member}' that doesn't exist`);