From 2ab776c3a5aacc8469e943062e37d043e5917b57 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Thu, 31 Jan 2013 07:47:37 -0800 Subject: [PATCH] Locally cache some references --- mustache.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mustache.js b/mustache.js index 93d20d6..af48fd1 100644 --- a/mustache.js +++ b/mustache.js @@ -32,10 +32,13 @@ var curlyRe = /\s*\}/; var tagRe = /#|\^|\/|>|\{|&|=|!/; + var _test = RegExp.prototype.test; + var _toString = Object.prototype.toString; + // 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); + return _test.call(re, string); } function isWhitespace(string) { @@ -43,7 +46,7 @@ } var isArray = Array.isArray || function (obj) { - return Object.prototype.toString.call(obj) === "[object Array]"; + return _toString.call(obj) === '[object Array]'; }; function escapeRe(string) {