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

Method applySharedKeys

ark/schema/structure/structure.ts:815–831  ·  view source on GitHub ↗
(
		data: object,
		ctx: InternalTraversal,
		// code compiled to write in place says so, as its ctx is any other's
		inPlace: boolean | undefined = ctx.inPlace
	)

Source from the content-addressed store, hash-verified

813 }
814
815 applySharedKeys(
816 data: object,
817 ctx: InternalTraversal,
818 // code compiled to write in place says so, as its ctx is any other's
819 inPlace: boolean | undefined = ctx.inPlace
820 ): boolean {
821 const errN = ctx.errN
822 this._traverse("Apply", data, ctx, false, inPlace)
823 for (const prop of this.inOrder)
824 if (prop.holdsValue(data)) this.tfSharedKey(data, prop.key, ctx, inPlace)
825 const isArray = Array.isArray(data)
826 for (const k of ownKeysOf(data)) {
827 if (!(k in this.byKey))
828 this.tfSharedKey(data, k, ctx, inPlace, isArray ? arrayPathKeyOf(k) : k)
829 }
830 return !ctx.failFast || ctx.errN === errN
831 }
832
833 /** transforms a key's value through each constraint transforming it: its prop or the index signatures it matches */
834 private tfSharedKey(

Callers 1

tApplyMethod · 0.95

Calls 5

_traverseMethod · 0.95
tfSharedKeyMethod · 0.95
arrayPathKeyOfFunction · 0.90
ownKeysOfFunction · 0.85
holdsValueMethod · 0.80

Tested by

no test coverage detected