regularjs/regular

考虑一下使用者可不可以自行配置Keyword

Closed this issue · 3 comments

regular中的代码

var isKeyWord = _.makePredicate("true false undefined null this Array Date JSON Math NaN RegExp decodeURI decodeURIComponent encodeURI encodeURIComponent parseFloat parseInt Object");

比如使用者可以通过Regular.config来配置,加入window, console等keyword

这个暂时不好做了,因为比较麻烦, isKeyword调用在parse阶段,这个阶段有可能运行时是不参与的。

比如你在程序之前,进行了config, 但是模板可能在服务端已经做好了预解析,将导致服务端的无法享受到这次config内容,导致不一致

服务端和客户端难道不是共用一套regular的config吗?

这个case 暂时不考虑, 比如window 在Node端不一定有.

还有一点是: 本质其实是引入了全局状态。