MCPcopy Create free account
hub / github.com/Effect-TS/effect / polluteObjectPrototype

Function polluteObjectPrototype

packages/rpc/test/RpcSerialization.test.ts:8–11  ·  view source on GitHub ↗
(property: PropertyKey, value: unknown)

Source from the content-addressed store, hash-verified

6const prototypeDescriptors = new Map<PropertyKey, PropertyDescriptor | undefined>()
7
8const polluteObjectPrototype = (property: PropertyKey, value: unknown) => {
9 prototypeDescriptors.set(property, Object.getOwnPropertyDescriptor(Object.prototype, property))
10 Object.defineProperty(Object.prototype, property, { configurable: true, value })
11}
12
13afterEach(() => {
14 for (const [property, descriptor] of prototypeDescriptors) {

Callers 1

Calls 1

setMethod · 0.65

Tested by

no test coverage detected