add util.errorWithNode method that returns an error with mapped location properties
This commit is contained in:
@@ -36,6 +36,13 @@ exports.parse = function (code, opts) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.errorWithNode = function (node, msg) {
|
||||
var err = new Error(msg);
|
||||
err.lineNumber = node.loc.start.line;
|
||||
err.column = node.loc.start.column;
|
||||
return err;
|
||||
};
|
||||
|
||||
exports.canCompile = function (filename) {
|
||||
return path.extname(filename) === ".js";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user