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

Method tfsOf

ark/schema/structure/structure.ts:998–1016  ·  view source on GitHub ↗

the steps transforming prop's value, shared by the constraints transforming its key

(prop: Prop.Node)

Source from the content-addressed store, hash-verified

996 private _tfsByKey: Record<Key, TransformStep[]> | undefined
997 /** the steps transforming prop's value, shared by the constraints transforming its key */
998 tfsOf(prop: Prop.Node): TransformStep[] {
999 const cached = this._tfsByKey?.[prop.key]
1000 if (cached) return cached
1001 const tfs: TransformStep[] = prop.value.tfs ? [{ node: prop.value }] : []
1002 if (!this.index) return tfs
1003 for (const index of this.index) {
1004 if (!index.value.tfs || index.value === prop.value) continue
1005 if (index.signature.allowsCtx) {
1006 tfs.push({
1007 node: index.value,
1008 signature: index.signature,
1009 indexed: true
1010 })
1011 } else if (index.signature.allows(prop.key))
1012 tfs.push({ node: index.value, indexed: true })
1013 }
1014 if (!isResolutionFinal()) return tfs
1015 return ((this._tfsByKey ??= Object.create(null))[prop.key] = tfs)
1016 }
1017
1018 // in order, so data missing several gets them as declared
1019 readonly defaultable: Optional.Node.withDefault[] =

Callers 7

tTransformMethod · 0.95
tfSharedKeyMethod · 0.95
applyStructMorphMethod · 0.95
jsTfMethod · 0.95
jsDeleteFromCopyMethod · 0.95
jsDeleteTransformMethod · 0.95
transformsKeyTwiceFunction · 0.80

Calls 3

isResolutionFinalFunction · 0.90
allowsMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected