Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

recast

Package Overview
Dependencies
Maintainers
1
Versions
266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recast - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

2

lib/options.js

@@ -5,2 +5,3 @@ var defaults = {

reuseWhitespace: true,
esprima: require("esprima"),
writeback: function(output) {

@@ -25,4 +26,5 @@ process.stdout.write(output);

reuseWhitespace: !!get("reuseWhitespace"),
esprima: get("esprima"),
writeback: get("writeback")
};
};

2

lib/parser.js

@@ -17,3 +17,3 @@ var assert = require("assert"),

var pure = require("esprima").parse(lines.toString({
var pure = options.esprima.parse(lines.toString({
tabWidth: options.tabWidth,

@@ -20,0 +20,0 @@ reuseWhitespace: false,

@@ -15,3 +15,3 @@ {

],
"version": "0.3.2",
"version": "0.3.3",
"homepage": "http://github.com/benjamn/recast",

@@ -18,0 +18,0 @@ "repository": {

@@ -125,1 +125,25 @@ var assert = require("assert"),

});
exports.testAlternateEsprima = function(t, assert) {
var types = require("../lib/types");
var b = types.builders;
var esprima = {
parse: function(code) {
var program = b.program([
b.expressionStatement(b.identifier("surprise"))
]);
program.comments = [];
return program;
}
};
var parser = new Parser("ignored", { esprima: esprima });
var ast = parser.getAst();
var printer = new Printer(parser);
types.namedTypes.File.assert(ast, true);
assert.strictEqual(
printer.printGenerically(ast).toString(),
"surprise;");
t.finish();
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc