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

Function assertUnchecked

ark/schema/shared/utils.ts:149–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147let assertingUnchecked = false
148
149export const assertUnchecked = (): void => {
150 // an assertion can resolve an alias, which asserts again, so what it queues
151 // runs in the outer loop
152 if (!isResolutionFinal() || assertingUnchecked) return
153 assertingUnchecked = true
154 let passed = false
155 let i = 0
156 try {
157 for (; i < uncheckedAssertions.length; i++) uncheckedAssertions[i]()
158 passed = true
159 } catch (e) {
160 for (const [fail, from, to, unrun] of uncheckedOwners) {
161 if (from <= i && i < to) fail(e)
162 // those up to i passed, so one whose checks all came before it did too
163 else if (i < from && from < to) unrun()
164 }
165 uncheckedOwners.length = 0
166 throw e
167 } finally {
168 assertingUnchecked = false
169 discardUnchecked(passed)
170 }
171}
172
173let discards = 0
174

Callers 4

resolveUncachedFunction · 0.90
resolutionMethod · 0.90
encodeFunction · 0.90
resolvingFunction · 0.85

Calls 3

isResolutionFinalFunction · 0.85
discardUncheckedFunction · 0.85
failFunction · 0.70

Tested by

no test coverage detected