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

Function copyWithout

packages/effect/src/ui/Query.ts:2443–2452  ·  view source on GitHub ↗
(o: object, names: ReadonlyArray<PropertyKey>)

Source from the content-addressed store, hash-verified

2441 * extension when `o` is.
2442 */
2443const copyWithout = (o: object, names: ReadonlyArray<PropertyKey>): object => {
2444 const descriptors: Record<PropertyKey, PropertyDescriptor> = Object
2445 .getOwnPropertyDescriptors(o)
2446 for (const name of names) delete descriptors[name]
2447 const out = Object.create(Object.getPrototypeOf(o), descriptors)
2448 if (Object.isFrozen(o)) Object.freeze(out)
2449 else if (Object.isSealed(o)) Object.seal(out)
2450 else if (!Object.isExtensible(o)) Object.preventExtensions(out)
2451 return out
2452}
2453
2454/**
2455 * Drops every optional property that is `undefined` from args that are a

Callers 1

dropUndefinedOfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected