Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
425 bytes
|
Line | |
---|
1 | module.exports = function walk(nodes, cb, bubble) {
|
---|
2 | var i, max, node, result;
|
---|
3 |
|
---|
4 | for (i = 0, max = nodes.length; i < max; i += 1) {
|
---|
5 | node = nodes[i];
|
---|
6 | if (!bubble) {
|
---|
7 | result = cb(node, i, nodes);
|
---|
8 | }
|
---|
9 |
|
---|
10 | if (
|
---|
11 | result !== false &&
|
---|
12 | node.type === "function" &&
|
---|
13 | Array.isArray(node.nodes)
|
---|
14 | ) {
|
---|
15 | walk(node.nodes, cb, bubble);
|
---|
16 | }
|
---|
17 |
|
---|
18 | if (bubble) {
|
---|
19 | cb(node, i, nodes);
|
---|
20 | }
|
---|
21 | }
|
---|
22 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.