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

Function keepOwn

ark/schema/shared/transform.ts:240–242  ·  view source on GitHub ↗
(out: object, data: object, k: Key)

Source from the content-addressed store, hash-verified

238// restores a declared key data holds as a non-enumerable own prop after a copy
239// (including one that shadows a prototype property)
240export const keepOwn = (out: object, data: object, k: Key): void => {
241 if (!hasOwn(out, k) && hasOwn(data, k)) setOwnValue(out, k, data[k as never])
242}
243
244/**
245 * what deleting undeclared keys makes of data other than a plain object, a copy

Callers 1

copyDeclaredFunction · 0.85

Calls 2

hasOwnFunction · 0.90
setOwnValueFunction · 0.70

Tested by

no test coverage detected