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