MCPcopy Create free account
hub / github.com/arktypeio/arktype / isSafePrototypeRead

Function isSafePrototypeRead

ark/aot/usage.ts:1213–1220  ·  view source on GitHub ↗
(
	operand: Node,
	parent: Node | undefined
)

Source from the content-addressed store, hash-verified

1211// a read of a prototype that neither mutates nor leaks it, e.g.
1212// `Array.prototype.slice.call(list)` or `proto === Object.prototype`
1213const isSafePrototypeRead = (
1214 operand: Node,
1215 parent: Node | undefined
1216): boolean =>
1217 (parent?.type === "MemberExpression" &&
1218 parent.object === operand &&
1219 !isWriteTarget(parent)) ||
1220 (parent?.type === "BinaryExpression" && isEqualityOperator(parent.operator))
1221
1222const isPrototypeMutatorCall = (
1223 operand: Node,

Callers 1

isBuiltinPrototypePatchFunction · 0.85

Calls 2

isWriteTargetFunction · 0.90
isEqualityOperatorFunction · 0.85

Tested by

no test coverage detected