MCPcopy
hub / github.com/lebab/lebab / splitDeclaration

Function splitDeclaration

src/transform/multiVar.js:17–33  ·  view source on GitHub ↗
(node, parent, logger)

Source from the content-addressed store, hash-verified

15}
16
17function splitDeclaration(node, parent, logger) {
18 const declNodes = node.declarations.map(declarator => {
19 return new VariableDeclaration(node.kind, [declarator]);
20 });
21
22 try {
23 multiReplaceStatement({
24 parent,
25 node,
26 replacements: declNodes,
27 preserveComments: true,
28 });
29 }
30 catch (e) {
31 logger.warn(parent, `Unable to split var statement in a ${parent.type}`, 'multi-var');
32 }
33}

Callers 1

enterFunction · 0.85

Calls 2

multiReplaceStatementFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…