jsepgen:微型模块(15 LOC)从jsep AST生成代码

时间:2021-05-11 08:38:45
【文件属性】:
文件名称:jsepgen:微型模块(15 LOC)从jsep AST生成代码
文件大小:3KB
文件格式:ZIP
更新时间:2021-05-11 08:38:45
JavaScript 杰斯普根 微型模块(42 LOC)从 AST生成代码。 例子 使用相同的键将所有变量和函数转换为对象 var jsep = require ( 'jsep' ) ; var gen = require ( 'gen' ) ; // parse the expression into an AST var ast = jsep ( '-A1 + SUM(A5, A6) + " %"' ) // replace variables and functions var expr = gen ( ast , function ( node ) { if ( node . type != 'Identifier' ) return node ; node . name = '_.' + node . name ; } ) expr // ((-_.A1 + _.SUM(_.A5, _.A6)
【文件预览】:
jsepgen-master
----.gitignore(13B)
----package.json(554B)
----Makefile(95B)
----History.md(641B)
----index.js(1KB)
----test.js(1KB)
----Readme.md(965B)
----.npmignore(29B)

网友评论