Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix: use has own property in some parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Anemy authored Dec 11, 2023
2 parents 531dbcf + 3bb358c commit 4e839c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (Object.prototype.hasOwnProperty.call(ALLOWED_CLASS_EXPRESSIONS, member)) {
const allowedMethods = ALLOWED_CLASS_EXPRESSIONS[member].allowedMethods;

if (typeof allowedMethods === 'string') {
Expand All @@ -248,7 +248,7 @@ export function isMethodWhitelisted(member: string, property: string): boolean {
}

export function getClass(member: string) {
if (ALLOWED_CLASS_EXPRESSIONS[member]) {
if (Object.prototype.hasOwnProperty.call(ALLOWED_CLASS_EXPRESSIONS, member)) {
return ALLOWED_CLASS_EXPRESSIONS[member].class;
}
throw new Error(`Attempted to access member '${member}' that doesn't exist`);
Expand Down

0 comments on commit 4e839c4

Please sign in to comment.