aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/css-tree/cjs/convertor
diff options
context:
space:
mode:
Diffstat (limited to 'vanilla/node_modules/css-tree/cjs/convertor')
-rw-r--r--vanilla/node_modules/css-tree/cjs/convertor/create.cjs32
-rw-r--r--vanilla/node_modules/css-tree/cjs/convertor/index.cjs8
2 files changed, 40 insertions, 0 deletions
diff --git a/vanilla/node_modules/css-tree/cjs/convertor/create.cjs b/vanilla/node_modules/css-tree/cjs/convertor/create.cjs
new file mode 100644
index 0000000..55c655b
--- /dev/null
+++ b/vanilla/node_modules/css-tree/cjs/convertor/create.cjs
@@ -0,0 +1,32 @@
+'use strict';
+
+const List = require('../utils/List.cjs');
+
+function createConvertor(walk) {
+ return {
+ fromPlainObject(ast) {
+ walk(ast, {
+ enter(node) {
+ if (node.children && node.children instanceof List.List === false) {
+ node.children = new List.List().fromArray(node.children);
+ }
+ }
+ });
+
+ return ast;
+ },
+ toPlainObject(ast) {
+ walk(ast, {
+ leave(node) {
+ if (node.children && node.children instanceof List.List) {
+ node.children = node.children.toArray();
+ }
+ }
+ });
+
+ return ast;
+ }
+ };
+}
+
+exports.createConvertor = createConvertor;
diff --git a/vanilla/node_modules/css-tree/cjs/convertor/index.cjs b/vanilla/node_modules/css-tree/cjs/convertor/index.cjs
new file mode 100644
index 0000000..6654278
--- /dev/null
+++ b/vanilla/node_modules/css-tree/cjs/convertor/index.cjs
@@ -0,0 +1,8 @@
+'use strict';
+
+const create = require('./create.cjs');
+const index$1 = require('../walker/index.cjs');
+
+const index = create.createConvertor(index$1);
+
+module.exports = index;