Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
968 bytes
|
Line | |
---|
1 | function removeItemAndRedundantWhiteSpace(list, item) {
|
---|
2 | var prev = item.prev;
|
---|
3 | var next = item.next;
|
---|
4 |
|
---|
5 | if (next !== null) {
|
---|
6 | if (next.data.type === 'WhiteSpace' && (prev === null || prev.data.type === 'WhiteSpace')) {
|
---|
7 | list.remove(next);
|
---|
8 | }
|
---|
9 | } else if (prev !== null && prev.data.type === 'WhiteSpace') {
|
---|
10 | list.remove(prev);
|
---|
11 | }
|
---|
12 |
|
---|
13 | list.remove(item);
|
---|
14 | }
|
---|
15 |
|
---|
16 | module.exports = function compressBorder(node) {
|
---|
17 | node.children.each(function(node, item, list) {
|
---|
18 | if (node.type === 'Identifier' && node.name.toLowerCase() === 'none') {
|
---|
19 | if (list.head === list.tail) {
|
---|
20 | // replace `none` for zero when `none` is a single term
|
---|
21 | item.data = {
|
---|
22 | type: 'Number',
|
---|
23 | loc: node.loc,
|
---|
24 | value: '0'
|
---|
25 | };
|
---|
26 | } else {
|
---|
27 | removeItemAndRedundantWhiteSpace(list, item);
|
---|
28 | }
|
---|
29 | }
|
---|
30 | });
|
---|
31 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.