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

Function setOwnValue

ark/schema/shared/transform.ts:225–235  ·  view source on GitHub ↗
(
	out: object,
	k: PropertyKey,
	value: unknown
)

Source from the content-addressed store, hash-verified

223}
224
225export const setOwnValue = (
226 out: object,
227 k: PropertyKey,
228 value: unknown
229): void => {
230 "use strict"
231 // an inherited key can be an accessor (like __proto__ or a class getter/setter)
232 // or a non-writable data property on a frozen prototype, so define an own value
233 if (k in out && !hasOwn(out, k)) defineValue(out, k, value)
234 else out[k as never] = value as never
235}
236
237// keeps data's own key on its copy where the spread skipped it, as a
238// restores a declared key data holds as a non-enumerable own prop after a copy

Callers 11

tfKeyMethod · 0.90
keepDeclaredMethod · 0.90
applyStructMorphMethod · 0.90
copyMethod · 0.90
writeFunction · 0.90
props.test.tsFile · 0.90
writeCopiedFunction · 0.70
joinKeptFunction · 0.70
keepOwnFunction · 0.70
copyDeclaredFunction · 0.70
mergeTransformedFunction · 0.70

Calls 2

hasOwnFunction · 0.90
defineValueFunction · 0.90

Tested by

no test coverage detected