Skip to content

Commit

Permalink
Locally cache some references
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Jan 31, 2013
1 parent 8b2b3cd commit 2ab776c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mustache.js
Expand Up @@ -32,18 +32,21 @@
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) {
return !testRe(nonSpaceRe, string);
}

var isArray = Array.isArray || function (obj) {
return Object.prototype.toString.call(obj) === "[object Array]";
return _toString.call(obj) === '[object Array]';
};

function escapeRe(string) {
Expand Down

0 comments on commit 2ab776c

Please sign in to comment.