Permalink
Browse files

* added shortcuts in lint module

  • Loading branch information...
jpolo
jpolo committed Nov 22, 2010
1 parent c65677d commit 9f06476530b4e0af81a3019f243e2612baeacba2
Showing with 14 additions and 5 deletions.
  1. +14 −5 lib/lint/index.js
View
@@ -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;

0 comments on commit 9f06476

Please sign in to comment.