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

Function orderedForAllows

ark/schema/structure/structure.ts:260–274  ·  view source on GitHub ↗
(props: array<Prop.Node>)

Source from the content-addressed store, hash-verified

258
259// cheaper props first, though never across one calling user code
260const orderedForAllows = (props: array<Prop.Node>): array<Prop.Node> => {
261 const ordered: Prop.Node[] = []
262 let run: Prop.Node[] = []
263 const flush = () =>
264 ordered.push(...run.sort((l, r) => allowsRank(l) - allowsRank(r)))
265 for (const prop of props) {
266 if (reachesUserCode(prop.value)) {
267 flush()
268 ordered.push(prop)
269 run = []
270 } else run.push(prop)
271 }
272 flush()
273 return ordered
274}
275
276interface CopyOptions {
277 /** whether the site is the first that can change out, so out is still data */

Callers 1

allowsPropsMethod · 0.85

Calls 3

reachesUserCodeFunction · 0.85
flushFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected