How to use the replace function from estraverse
Find comprehensive JavaScript estraverse.replace code examples handpicked from public code repositorys.
GitHub: codemix/contractual

118 119 120 121 122 123 124 125 126 127
function processFunctions (ast, options) { pre: ast && typeof ast === 'object'; main: var total = 0; estraverse.replace(ast, { enter: function (node) { var result; if (node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression') { result = collectLabels(node, options);
+ 3 other calls in file
16 17 18 19 20 21 22 23 24 25
this.options = options; this.matchers = options.patterns.map(function (pattern) { return escallmatch(pattern, options); }); } Instrumentor.prototype.instrument = function (ast) { return estraverse.replace(ast, this.createVisitor(ast)); }; Instrumentor.prototype.createVisitor = function (ast) { verifyAstPrerequisites(ast, this.options);
GitHub: puffnfresh/rephrase

116 117 118 119 120 121 122 123 124
return subs; } function substitute(subs, boundTo, to) { return estraverse.replace(deepCopy(to), { enter: function(node) { if(boundTo.indexOf(node) == -1) return;
+ 3 other calls in file
18 19 20 21 22 23 24 25 26 27
} check(tree) { const methods = this; tree = estraverse.replace(tree, { enter: function(node, parent) { if (node.type === "apply") { node = methods.checkApplyEnter(node); } else if (node.type === "word") {
+ 4 other calls in file
estraverse.traverse is the most popular function in estraverse (171 examples)