Quellcode durchsuchen

Add lint task using JSHint

tags/0.5.2
Michael Jackson vor 14 Jahren
Ursprung
Commit
9079bd88f2
3 geänderte Dateien mit 21 neuen und 7 gelöschten Zeilen
  1. +5
    -0
      .jshintrc
  2. +5
    -0
      Rakefile
  3. +11
    -7
      mustache.js

+ 5
- 0
.jshintrc Datei anzeigen

@@ -0,0 +1,5 @@
{
"eqnull": true,
"evil": true
}


+ 5
- 0
Rakefile Datei anzeigen

@@ -25,6 +25,11 @@ task :minify do
sh "uglifyjs mustache.js > #{minified_file}"
end

desc "Run JSHint, requires jshint (see http://www.jshint.com)"
task :lint do
sh "jshint mustache.js"
end

# Creates a task that uses the various template wrappers to make a wrapped
# output file. There is some extra complexity because Dojo and YUI use
# different final locations.


+ 11
- 7
mustache.js Datei anzeigen

@@ -64,7 +64,7 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {};
}

function escapeRe(string) {
return string.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
}

var entityMap = {
@@ -243,21 +243,25 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {};
case "object":
if (isArray(value)) {
var buffer = "";

for (var i = 0, len = value.length; i < len; ++i) {
buffer += callback(context.push(value[i]), this);
}

return buffer;
} else {
return callback(context.push(value), this);
}
break;

return callback(context.push(value), this);
case "function":
var sectionText = callback(context, this), self = this;
// TODO: The text should be passed to the callback plain, not rendered.
var sectionText = callback(context, this),
self = this;

var scopedRender = function (template) {
return self.render(template, context);
};

return value.call(context.view, sectionText, scopedRender) || "";
break;
default:
if (value) {
return callback(context, this);
@@ -549,7 +553,7 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {};

// The high-level clearCache, compile, compilePartial, and render functions
// use this default renderer.
var _renderer = new Renderer;
var _renderer = new Renderer();

/**
* Clears all cached templates and partials.


Laden…
Abbrechen
Speichern