|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
804 bytes
|
| Line | |
|---|
| 1 | var List = require('../common/List');
|
|---|
| 2 |
|
|---|
| 3 | module.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.