3 ms·
That works. An alternative could be to do it during build with a babel based tool. Earlier, I wrote a tool called chimpanzee[1] to parse such ASTs into SQL. No
by jeswin 7y ago
That works. An alternative could be to do it during build with a babel based tool.
Earlier, I wrote a tool called chimpanzee[1] to parse such ASTs into SQL. Not easy (but not too hard either); there are so many different ways to express something in JS. Here's an example (using chimpanzee) which checks if an expression is doing a sort (on an array/table) and to extract sort fields and order. https://github.com/jeswin-unmaintained/isotropy-ast-analyzer-db/blob/master/src/schemas/sort.js https://github.com/jeswin-unmaintained/isotropy-ast-analyzer...
[1] chimpanzee: https://github.com/jeswin/chimpanzee https://github.com/jeswin/chimpanzee