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