ReckonJS轻量级JavaScript字符串插值库
计算JS 一个轻量级的 JavaScript 字符串插值库。它是什么? ReckonJS 是一个简单的库,可以在 JavaScript(浏览器或 NodeJS)中使用模板字符串。下面是如何使用 ReckonJS 的简单示例:
这个怎么运作?在浏览器中样本数据:
var scope = { fullName: 'John Doe', age: 20, ageNextYear: function() { return this.age + 1; } };
var introduction = 'My name is {{fullName}}, and next year, I will turn {{ageNextYear}}';
introduction = introduction.reckon(scope);
下载地址
用户评论