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

Function keepDeclared

ark/type/checkers.ts:846–852  ·  view source on GitHub ↗
(declared: Props, data: any, out: any)

Source from the content-addressed store, hash-verified

844
845// restores declared keys data held as non-enumerable own props after a copy
846const keepDeclared = (declared: Props, data: any, out: any): any => {
847 if (out !== data) {
848 for (const k in declared)
849 if (!hasOwn(out, k) && hasOwn(data, k)) setOwnValue(out, k, data[k])
850 }
851 return out
852}
853
854// what props write where nothing can fail, a value's transform returning an
855// object and a default being a literal. Only the keys changing can write are

Callers 5

writtenPropsFunction · 0.70
writtenValuesFunction · 0.70
deletesFunction · 0.70
sitedKeepsFunction · 0.70
applyStructMorphMethod · 0.50

Calls 2

hasOwnFunction · 0.90
setOwnValueFunction · 0.90

Tested by

no test coverage detected