Urara-Blog/node_modules/.pnpm-store/v3/files/73/cc628833d6f5651313f77a3eb55508b0f2b4f7615abb7b9a2b1d459e11399124ac5388264f922c0280453b2dd85859802e4424c4e42246234fa2b159a710f5
2022-08-14 01:14:53 +08:00

22 lines
425 B
Text

module.exports = function walk(nodes, cb, bubble) {
var i, max, node, result;
for (i = 0, max = nodes.length; i < max; i += 1) {
node = nodes[i];
if (!bubble) {
result = cb(node, i, nodes);
}
if (
result !== false &&
node.type === "function" &&
Array.isArray(node.nodes)
) {
walk(node.nodes, cb, bubble);
}
if (bubble) {
cb(node, i, nodes);
}
}
};