浏览代码

Replace Map with Object for old node support.

pull/731/head
Andrew Leedham 6 年前
父节点
当前提交
ec87dd4ae7
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. +3
    -3
      test/parse-test.js

+ 3
- 3
test/parse-test.js 查看文件

@@ -170,16 +170,16 @@ describe('Mustache.parse', function () {
it('returns the same tokens for the latter parse', function () {
Mustache.toggleCache(false);
var parse = Mustache.Writer.prototype.parse;
var cache = new Map();
var cache = {};

Mustache.Writer.prototype.parse = function (template, tags) {
var cacheKey = template + ':' + (tags || Mustache.tags).join(':');
var fromCache = cache.get(cacheKey);
var fromCache = cache[cacheKey];
if (fromCache) {
return fromCache;
} else {
var tokens = parse.call(this, template, tags);
cache.set(cacheKey, tokens);
cache[cacheKey] = tokens;
return tokens;
}
};


正在加载...
取消
保存