mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
fix: clarify blocked key checks in readJSProperty
Split the OR condition into two explicit checks so inherited proto keys are always blocked and own proto keys are blocked only when ownPropertyOnly is true. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -159,7 +159,8 @@ const BLOCKED_SCOPE_KEYS: ReadonlySet<PropertyKey> = new Set(['__proto__', 'cons
|
|||||||
|
|
||||||
export function readJSProperty (obj: Scope, key: PropertyKey, ownPropertyOnly: boolean) {
|
export function readJSProperty (obj: Scope, key: PropertyKey, ownPropertyOnly: boolean) {
|
||||||
if (BLOCKED_SCOPE_KEYS.has(key)) {
|
if (BLOCKED_SCOPE_KEYS.has(key)) {
|
||||||
if (ownPropertyOnly || !hasOwnProperty.call(obj, key)) return undefined
|
if (!hasOwnProperty.call(obj, key)) return undefined
|
||||||
|
if (ownPropertyOnly) return undefined
|
||||||
}
|
}
|
||||||
if (ownPropertyOnly && !hasOwnProperty.call(obj, key) && !(obj instanceof Drop)) return undefined
|
if (ownPropertyOnly && !hasOwnProperty.call(obj, key) && !(obj instanceof Drop)) return undefined
|
||||||
return obj[key]
|
return obj[key]
|
||||||
|
|||||||
Reference in New Issue
Block a user