9 ms·
> JavaScript ORMs would be revolutionized if they had this ability. Is this possible in JavaScript?
by vosper 1y ago
> JavaScript ORMs would be revolutionized if they had this ability.
Is this possible in JavaScript?
- Arnavion 1y agoThere is a limited form of such "expression rewriting" using tagged template strings introduced in ES2015. But it wouldn't be particularly useful for the ORM case.
- paavohtl 1y agoNot easily. There's no built-in way to access the abstract syntax tree (or equivalent) of a function at run time. The best thing you can do is to obtain the source code of a function using `.toString()` and then use a separate JS parser to process it, but that's not a very realistic option.