MCPcopy
hub / github.com/lebab/lebab / enter

Function enter

src/transform/forEach/index.js:11–27  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

9export default function(ast, logger) {
10 traverser.replace(ast, {
11 enter(node) {
12 const matches = matchAliasedForLoop(node);
13
14 if (matches) {
15 const warning = validateForLoop(node, matches);
16 if (warning) {
17 logger.warn(...warning, 'for-each');
18 return;
19 }
20
21 return withComments(node, createForEach(matches));
22 }
23
24 if (node.type === 'ForStatement') {
25 logger.warn(node, 'Unable to transform for loop', 'for-each');
26 }
27 }
28 });
29}
30

Callers

nothing calls this directly

Calls 4

validateForLoopFunction · 0.85
createForEachFunction · 0.85
warnMethod · 0.80
withCommentsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…