Socket
Socket
Sign inDemoInstall

acorn

Package Overview
Dependencies
Maintainers
1
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acorn - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

acorn_loose.js

2

package.json

@@ -6,3 +6,3 @@ {

"main": "acorn.js",
"version": "0.0.1",
"version": "0.1.0",
"engines": {"node": ">=0.4.0"},

@@ -9,0 +9,0 @@ "maintainers": [{"name": "Marijn Haverbeke",

@@ -11,5 +11,8 @@ (function(exports) {

};
exports.testAssert = function(code, assert, options) {
tests.push({code: code, assert: assert, options: options});
};
exports.runTests = function(callback) {
var opts = {linePositions: true};
var opts = {locations: true};
for (var i = 0; i < tests.length; ++i) {

@@ -21,3 +24,8 @@ var test = tests[i];

"Expected error message: " + test.error + "\nBut parsing succeeded.");
else {
else if (test.assert) {
var error = test.assert(ast);
if (error) callback("fail", test.code,
"\n Assertion failed:\n " + error);
else callback("ok", test.code);
} else {
var mis = misMatch(test.ast, ast);

@@ -63,2 +71,25 @@ if (!mis) callback("ok", test.code);

}
function mangle(ast) {
if (typeof ast != "object" || !ast) return;
if (ast.slice) {
for (var i = 0; i < ast.length; ++i) mangle(ast[i]);
} else {
var loc = ast.start && ast.end && {start: ast.start, end: ast.end};
if (loc) { delete ast.start; delete ast.end; }
for (var name in ast) if (ast.hasOwnProperty(name)) mangle(ast[name]);
if (loc) ast.loc = loc;
}
}
exports.printTests = function() {
var out = "";
for (var i = 0; i < tests.length; ++i) {
if (tests[i].error) continue;
mangle(tests[i].ast);
out += "test(" + JSON.stringify(tests[i].code) + ", " + JSON.stringify(tests[i].ast, null, 2) + ");\n\n";
}
document.body.innerHTML = "";
document.body.appendChild(document.createElement("pre")).appendChild(document.createTextNode(out));
};
})(typeof exports == "undefined" ? window : exports);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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