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

Function isRunOnce

ark/aot/flat.ts:1827–1843  ·  view source on GitHub ↗
(id: Node)

Source from the content-addressed store, hash-verified

1825
1826// a function's read the units' own body runs, once, as no function, class or loop holds it
1827const isRunOnce = (id: Node): boolean => {
1828 for (let node = id.parent; node; node = node.parent) {
1829 switch (node.type) {
1830 case "ArrowFunctionExpression":
1831 case "FunctionExpression":
1832 case "FunctionDeclaration":
1833 case "ClassBody":
1834 case "ForStatement":
1835 case "ForInStatement":
1836 case "ForOfStatement":
1837 case "WhileStatement":
1838 case "DoWhileStatement":
1839 return false
1840 }
1841 }
1842 return true
1843}
1844
1845// a value's read run once, and whenever its statement is, as an element, an argument or a property's value
1846const isRunSurely = (id: Node): boolean => {

Callers 1

writtenWhereReadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected