From 144d8bef85eaac11308493897bb7271ef2f5b469 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Wed, 20 Jun 2012 21:02:22 -0700 Subject: [PATCH] Workaround for old SpiderMonkey builds Fixes #189 --- mustache.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mustache.js b/mustache.js index a242c1c..24b1c19 100644 --- a/mustache.js +++ b/mustache.js @@ -38,8 +38,14 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {}; var curlyRe = /\s*\}/; var tagRe = /#|\^|\/|>|\{|&|=|!/; + // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577 + // See https://github.com/janl/mustache.js/issues/189 + function testRe(re, string) { + return RegExp.prototype.test.call(re, string); + } + function isWhitespace(string) { - return !nonSpaceRe.test(string); + return !testRe(nonSpaceRe, string); } var isArray = Array.isArray || function (obj) {