UNPKG

564 BJavaScriptView Raw
1"use strict";
2
3module.exports = function(params) {
4 const { div, index, nodes, expectation, position, symb } = params;
5
6 if (expectation.indexOf("always") === 0) {
7 div[position] = symb;
8
9 return true;
10 } else if (expectation.indexOf("never") === 0) {
11 div[position] = "";
12
13 for (let i = index + 1; i < nodes.length; i++) {
14 const node = nodes[i];
15
16 if (node.type === "comment") {
17 continue;
18 }
19
20 if (node.type === "space") {
21 node.value = "";
22 continue;
23 }
24
25 break;
26 }
27
28 return true;
29 }
30};