larry babby and threejs for glsl

This commit is contained in:
Sam committed 2024-06-24 21:24:00 +12:00
1 parent 87d5dc634d
commit 907ebae4c0
6474 files changed
+1279596 -8

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import { List } from '../utils/List.js';
export function createConvertor(walk) {
return {
fromPlainObject(ast) {
walk(ast, {
enter(node) {
if (node.children && node.children instanceof List === false) {
node.children = new List().fromArray(node.children);
}
}
});
return ast;
},
toPlainObject(ast) {
walk(ast, {
leave(node) {
if (node.children && node.children instanceof List) {
node.children = node.children.toArray();
}
}
});
return ast;
}
};
};
+4
View File
@@ -0,0 +1,4 @@
import { createConvertor } from './create.js';
import walker from '../walker/index.js';
export default createConvertor(walker);