Browse Source

change public api

formatter
Brett Langdon 11 years ago
parent
commit
7e7261f0ef
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      lib/index.js

+ 5
- 3
lib/index.js View File

@ -95,11 +95,11 @@ var parseExpressions = function(expr){
return expressions;
};
module.exports.parseDataFile = function(filename, options){
return module.exports.parseData(fs.readFileSync(filename, 'utf-8'), options);
module.exports.parseFile = function(filename, options){
return module.exports.parseContents(fs.readFileSync(filename, 'utf-8'), options);
};
module.exports.parseData = function(contents, options){
module.exports.parseContents = function(contents, options){
options = options || {};
var tolerant = (options.tolerant === undefined)? true: options.tolerant;
var parsed = esprima.parse(contents, {comment: true, loc: true, tolerant: tolerant});
@ -119,3 +119,5 @@ module.exports.parseData = function(contents, options){
return results;
};
module.exports.parse = module.exports.parseFile;

Loading…
Cancel
Save