Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* added shortcuts in lint module

  • Loading branch information...
commit 9f06476530b4e0af81a3019f243e2612baeacba2 1 parent c65677d
jpolo authored
Showing with 14 additions and 5 deletions.
  1. +14 −5 lib/lint/index.js
View
19 lib/lint/index.js
@@ -13,20 +13,29 @@ function isValid(content, options) {
function isValidFile(filePath, options, callback) {
fs.readFile(filePath, function (error, data) {
- var parser;
+ var parser, result;
if (error) {
- throw error;
+ if (callback) {
+ callback(error);
+ }
} else {
parser = new parser.Parser(options);
- parser.update(data).isValid();
-
+ result = parser.update(data).isValid();
+ if (callback) {
+ callback(undefined, result);
+ }
}
});
}
function isValidFileSync(filePath, options) {
-
+ var data, parser, result;
+ data = fs.readFileSync(filePath);
+ parser = new parser.Parser(options);
+ result = parser.update(data).isValid();
+
+ return result;
}
exports.Formatter = formatter.Formatter;
Please sign in to comment.
Something went wrong with that request. Please try again.