Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 3 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Aug 07, 2012
@kannix kannix fixed CommonJS check
QUnit defines module too. If you try to use mustache in a QUnit and AMD environment it won't work
2afdb08
@mjackson Merge pull request #243 from kannix/patch-1
more stringent CommonJS check
2a51eef
Commits on Aug 14, 2012
@mjackson throw inside the if 52c7e43
Showing with 7 additions and 7 deletions.
  1. +7 −7 mustache.js
View
14 mustache.js
@@ -8,7 +8,7 @@
var Mustache;
(function (exports) {
- if (typeof module !== "undefined") {
+ if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
module.exports = exports; // CommonJS
} else if (typeof define === "function") {
define(exports); // AMD
@@ -376,14 +376,14 @@ var Mustache;
}
function escapeTags(tags) {
- if (tags.length === 2) {
- return [
- new RegExp(escapeRe(tags[0]) + "\\s*"),
- new RegExp("\\s*" + escapeRe(tags[1]))
- ];
+ if (tags.length !== 2) {
+ throw new Error("Invalid tags: " + tags.join(" "));
}
- throw new Error("Invalid tags: " + tags.join(" "));
+ return [
+ new RegExp(escapeRe(tags[0]) + "\\s*"),
+ new RegExp("\\s*" + escapeRe(tags[1]))
+ ];
}
/**

No commit comments for this range

Something went wrong with that request. Please try again.