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

Function elementsFrom

ark/type/runtime.ts:1050–1060  ·  view source on GitHub ↗
(
		allows: (data: unknown) => boolean,
		apply: CompactApply,
		i: number,
		data: readonly unknown[]
	)

Source from the content-addressed store, hash-verified

1048// a root array's Apply from i, the first element `allows` rejected
1049const elementsFrom =
1050 (
1051 allows: (data: unknown) => boolean,
1052 apply: CompactApply,
1053 i: number,
1054 data: readonly unknown[]
1055 ): CompactApply =>
1056 (_, ctx) => {
1057 for (let j = i; j < data.length; j++)
1058 if (!allows(data[j]) && ctx._k(apply, data, j)) return false
1059 return true
1060 }
1061
1062export const applyElements = (
1063 allows: (data: unknown) => boolean,

Callers 2

applyElementsFunction · 0.85
unreadElementsFunction · 0.85

Calls 2

allowsFunction · 0.70
_kMethod · 0.65

Tested by

no test coverage detected