source: trip-planner-front/node_modules/css-tree/lib/convertor/create.js@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 804 bytes
Line 
1var List = require('../common/List');
2
3module.exports = function createConvertors(walk) {
4 return {
5 fromPlainObject: function(ast) {
6 walk(ast, {
7 enter: function(node) {
8 if (node.children && node.children instanceof List === false) {
9 node.children = new List().fromArray(node.children);
10 }
11 }
12 });
13
14 return ast;
15 },
16 toPlainObject: function(ast) {
17 walk(ast, {
18 leave: function(node) {
19 if (node.children && node.children instanceof List) {
20 node.children = node.children.toArray();
21 }
22 }
23 });
24
25 return ast;
26 }
27 };
28};
Note: See TracBrowser for help on using the repository browser.