Socket
Socket
Sign inDemoInstall

esprima

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esprima - npm Package Compare versions

Comparing version 1.2.4 to 2.0.0

32

package.json

@@ -10,3 +10,3 @@ {

},
"version": "1.2.4",
"version": "2.0.0",
"files": [

@@ -35,3 +35,3 @@ "bin",

"type": "git",
"url": "http://github.com/ariya/esprima.git"
"url": "https://github.com/jquery/esprima.git"
},

@@ -43,12 +43,12 @@ "bugs": {

"type": "BSD",
"url": "http://github.com/ariya/esprima/raw/master/LICENSE.BSD"
"url": "https://github.com/jquery/esprima/raw/master/LICENSE.BSD"
}],
"devDependencies": {
"jslint": "~0.1.9",
"eslint": "~0.4.3",
"jscs": "~1.2.4",
"eslint": "~0.12.0",
"jscs": "~1.10.0",
"istanbul": "~0.2.6",
"complexity-report": "~0.6.1",
"regenerate": "~0.5.4",
"unicode-6.3.0": "~0.1.0",
"escomplex-js": "1.0.0",
"complexity-report": "~1.1.1",
"regenerate": "~0.6.2",
"unicode-7.0.0": "~0.1.5",
"json-diff": "~0.3.1",

@@ -67,18 +67,14 @@ "optimist": "~0.6.0"

"test": "npm run-script lint && node test/run.js && npm run-script coverage && npm run-script complexity",
"test": "node test/run.js && npm run lint && npm run coverage",
"lint": "npm run-script check-version && npm run-script eslint && npm run-script jscs && npm run-script jslint",
"lint": "npm run check-version && npm run eslint && npm run jscs && npm run complexity",
"check-version": "node tools/check-version.js",
"jscs": "jscs esprima.js test/*test.js",
"eslint": "node node_modules/eslint/bin/eslint.js esprima.js",
"jscs": "node node_modules/jscs/bin/jscs esprima.js",
"jslint": "node node_modules/jslint/bin/jslint.js esprima.js",
"complexity": "node tools/list-complexity.js && cr -s -l -w --maxcyc 16 esprima.js",
"coverage": "npm run-script analyze-coverage && npm run-script check-coverage",
"coverage": "npm run analyze-coverage && npm run check-coverage",
"analyze-coverage": "node node_modules/istanbul/lib/cli.js cover test/runner.js",
"check-coverage": "node node_modules/istanbul/lib/cli.js check-coverage --statement 100 --branch 100 --function 100",
"complexity": "npm run-script analyze-complexity && npm run-script check-complexity",
"analyze-complexity": "node tools/list-complexity.js",
"check-complexity": "node node_modules/complexity-report/src/cli.js --maxcc 14 --silent -l -w esprima.js",
"benchmark": "node test/benchmarks.js",

@@ -85,0 +81,0 @@ "benchmark-quick": "node test/benchmarks.js quick"

@@ -6,3 +6,3 @@ **Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance,

Esprima is created and maintained by [Ariya Hidayat](http://twitter.com/ariyahidayat),
with the help of [many contributors](https://github.com/ariya/esprima/contributors).
with the help of [many contributors](https://github.com/jquery/esprima/contributors).

@@ -15,3 +15,3 @@ ### Features

- Optional tracking of syntax node location (index-based and line-column)
- Heavily tested (> 650 [unit tests](http://esprima.org/test/) with [full code coverage](http://esprima.org/test/coverage.html))
- Heavily tested (> 700 [unit tests](http://esprima.org/test/) with [full code coverage](http://esprima.org/test/coverage.html))
- [Partial support](http://esprima.org/doc/es6.html) for ECMAScript 6

@@ -18,0 +18,0 @@

@@ -99,2 +99,5 @@ /*

return undefined;
} else if (key === 'regex' && typeof value === "object") {
// Ignore Esprima-specific 'regex' property.
return undefined;
}

@@ -101,0 +104,0 @@ return value;

@@ -22,8 +22,8 @@ // This is modified from Mozilla Reflect.parse test suite (the file is located

function program(elts) { return Pattern({ type: "Program", body: elts }) }
function exprStmt(expr) { return Pattern({ type: "ExpressionStatement", expression: expr }) }
function throwStmt(expr) { return Pattern({ type: "ThrowStatement", argument: expr }) }
function returnStmt(expr) { return Pattern({ type: "ReturnStatement", argument: expr }) }
function yieldExpr(expr) { return Pattern({ type: "YieldExpression", argument: expr }) }
function lit(val) { return Pattern({ type: "Literal", value: val }) }
function program(elts) { return Pattern({ type: "Program", body: elts }); }
function exprStmt(expr) { return Pattern({ type: "ExpressionStatement", expression: expr }); }
function throwStmt(expr) { return Pattern({ type: "ThrowStatement", argument: expr }); }
function returnStmt(expr) { return Pattern({ type: "ReturnStatement", argument: expr }); }
function yieldExpr(expr) { return Pattern({ type: "YieldExpression", argument: expr }); }
function lit(val) { return Pattern({ type: "Literal", value: val }); }
var thisExpr = Pattern({ type: "ThisExpression" });

@@ -38,3 +38,3 @@ function funDecl(id, params, body) { return Pattern({ type: "FunctionDeclaration",

expression: false
}) }
}); }
function genFunDecl(id, params, body) { return Pattern({ type: "FunctionDeclaration",

@@ -48,28 +48,28 @@ id: id,

expression: false
}) }
function declarator(id, init) { return Pattern({ type: "VariableDeclarator", id: id, init: init }) }
function varDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "var" }) }
function letDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "let" }) }
function constDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "const" }) }
function ident(name) { return Pattern({ type: "Identifier", name: name }) }
function dotExpr(obj, id) { return Pattern({ type: "MemberExpression", computed: false, object: obj, property: id }) }
function memExpr(obj, id) { return Pattern({ type: "MemberExpression", computed: true, object: obj, property: id }) }
function forStmt(init, test, update, body) { return Pattern({ type: "ForStatement", init: init, test: test, update: update, body: body }) }
function forInStmt(lhs, rhs, body) { return Pattern({ type: "ForInStatement", left: lhs, right: rhs, body: body, each: false }) }
function forEachInStmt(lhs, rhs, body) { return Pattern({ type: "ForInStatement", left: lhs, right: rhs, body: body, each: true }) }
function breakStmt(lab) { return Pattern({ type: "BreakStatement", label: lab }) }
function continueStmt(lab) { return Pattern({ type: "ContinueStatement", label: lab }) }
function blockStmt(body) { return Pattern({ type: "BlockStatement", body: body }) }
}); }
function declarator(id, init) { return Pattern({ type: "VariableDeclarator", id: id, init: init }); }
function varDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "var" }); }
function letDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "let" }); }
function constDecl(decls) { return Pattern({ type: "VariableDeclaration", declarations: decls, kind: "const" }); }
function ident(name) { return Pattern({ type: "Identifier", name: name }); }
function dotExpr(obj, id) { return Pattern({ type: "MemberExpression", computed: false, object: obj, property: id }); }
function memExpr(obj, id) { return Pattern({ type: "MemberExpression", computed: true, object: obj, property: id }); }
function forStmt(init, test, update, body) { return Pattern({ type: "ForStatement", init: init, test: test, update: update, body: body }); }
function forInStmt(lhs, rhs, body) { return Pattern({ type: "ForInStatement", left: lhs, right: rhs, body: body, each: false }); }
function forEachInStmt(lhs, rhs, body) { return Pattern({ type: "ForInStatement", left: lhs, right: rhs, body: body, each: true }); }
function breakStmt(lab) { return Pattern({ type: "BreakStatement", label: lab }); }
function continueStmt(lab) { return Pattern({ type: "ContinueStatement", label: lab }); }
function blockStmt(body) { return Pattern({ type: "BlockStatement", body: body }); }
var emptyStmt = Pattern({ type: "EmptyStatement" });
function ifStmt(test, cons, alt) { return Pattern({ type: "IfStatement", test: test, alternate: alt, consequent: cons }) }
function labStmt(lab, stmt) { return Pattern({ type: "LabeledStatement", label: lab, body: stmt }) }
function withStmt(obj, stmt) { return Pattern({ type: "WithStatement", object: obj, body: stmt }) }
function whileStmt(test, stmt) { return Pattern({ type: "WhileStatement", test: test, body: stmt }) }
function doStmt(stmt, test) { return Pattern({ type: "DoWhileStatement", test: test, body: stmt }) }
function switchStmt(disc, cases) { return Pattern({ type: "SwitchStatement", discriminant: disc, cases: cases }) }
function caseClause(test, stmts) { return Pattern({ type: "SwitchCase", test: test, consequent: stmts }) }
function defaultClause(stmts) { return Pattern({ type: "SwitchCase", test: null, consequent: stmts }) }
function catchClause(id, guard, body) { if (guard) { return Pattern({ type: "GuardedCatchClause", param: id, guard: guard, body: body }) } else { return Pattern({ type: "CatchClause", param: id, body: body }) } }
function tryStmt(body, guarded, catches, fin) { return Pattern({ type: "TryStatement", block: body, guardedHandlers: guarded, handlers: catches, finalizer: fin }) }
function letStmt(head, body) { return Pattern({ type: "LetStatement", head: head, body: body }) }
function ifStmt(test, cons, alt) { return Pattern({ type: "IfStatement", test: test, alternate: alt, consequent: cons }); }
function labStmt(lab, stmt) { return Pattern({ type: "LabeledStatement", label: lab, body: stmt }); }
function withStmt(obj, stmt) { return Pattern({ type: "WithStatement", object: obj, body: stmt }); }
function whileStmt(test, stmt) { return Pattern({ type: "WhileStatement", test: test, body: stmt }); }
function doStmt(stmt, test) { return Pattern({ type: "DoWhileStatement", test: test, body: stmt }); }
function switchStmt(disc, cases) { return Pattern({ type: "SwitchStatement", discriminant: disc, cases: cases }); }
function caseClause(test, stmts) { return Pattern({ type: "SwitchCase", test: test, consequent: stmts }); }
function defaultClause(stmts) { return Pattern({ type: "SwitchCase", test: null, consequent: stmts }); }
function catchClause(id, guard, body) { if (guard) { return Pattern({ type: "GuardedCatchClause", param: id, guard: guard, body: body }) } else { return Pattern({ type: "CatchClause", param: id, body: body }); } }
function tryStmt(body, guarded, catches, fin) { return Pattern({ type: "TryStatement", block: body, guardedHandlers: guarded, handlers: catches, finalizer: fin }); }
function letStmt(head, body) { return Pattern({ type: "LetStatement", head: head, body: body }); }
function funExpr(id, args, body, gen) { return Pattern({ type: "FunctionExpression",

@@ -83,3 +83,3 @@ id: id,

expression: false
}) }
}); }
function genFunExpr(id, args, body) { return Pattern({ type: "FunctionExpression",

@@ -93,25 +93,25 @@ id: id,

expression: false
}) }
}); }
function unExpr(op, arg) { return Pattern({ type: "UnaryExpression", operator: op, argument: arg, prefix: true }) }
function binExpr(op, left, right) { return Pattern({ type: "BinaryExpression", operator: op, left: left, right: right }) }
function aExpr(op, left, right) { return Pattern({ type: "AssignmentExpression", operator: op, left: left, right: right }) }
function updExpr(op, arg, prefix) { return Pattern({ type: "UpdateExpression", operator: op, argument: arg, prefix: prefix }) }
function logExpr(op, left, right) { return Pattern({ type: "LogicalExpression", operator: op, left: left, right: right }) }
function unExpr(op, arg) { return Pattern({ type: "UnaryExpression", operator: op, argument: arg, prefix: true }); }
function binExpr(op, left, right) { return Pattern({ type: "BinaryExpression", operator: op, left: left, right: right }); }
function aExpr(op, left, right) { return Pattern({ type: "AssignmentExpression", operator: op, left: left, right: right }); }
function updExpr(op, arg, prefix) { return Pattern({ type: "UpdateExpression", operator: op, argument: arg, prefix: prefix }); }
function logExpr(op, left, right) { return Pattern({ type: "LogicalExpression", operator: op, left: left, right: right }); }
function condExpr(test, cons, alt) { return Pattern({ type: "ConditionalExpression", test: test, consequent: cons, alternate: alt }) }
function seqExpr(exprs) { return Pattern({ type: "SequenceExpression", expressions: exprs }) }
function newExpr(callee, args) { return Pattern({ type: "NewExpression", callee: callee, arguments: args }) }
function callExpr(callee, args) { return Pattern({ type: "CallExpression", callee: callee, arguments: args }) }
function arrExpr(elts) { return Pattern({ type: "ArrayExpression", elements: elts }) }
function objExpr(elts) { return Pattern({ type: "ObjectExpression", properties: elts }) }
function objProp(key, value, kind) { return Pattern({ type: "Property", key: key, value: value, kind: kind }) }
function condExpr(test, cons, alt) { return Pattern({ type: "ConditionalExpression", test: test, consequent: cons, alternate: alt }); }
function seqExpr(exprs) { return Pattern({ type: "SequenceExpression", expressions: exprs }); }
function newExpr(callee, args) { return Pattern({ type: "NewExpression", callee: callee, arguments: args }); }
function callExpr(callee, args) { return Pattern({ type: "CallExpression", callee: callee, arguments: args }); }
function arrExpr(elts) { return Pattern({ type: "ArrayExpression", elements: elts }); }
function objExpr(elts) { return Pattern({ type: "ObjectExpression", properties: elts }); }
function objProp(key, value, kind) { return Pattern({ type: "Property", key: key, value: value, kind: kind, method: false, shorthand: false }); }
function arrPatt(elts) { return Pattern({ type: "ArrayPattern", elements: elts }) }
function objPatt(elts) { return Pattern({ type: "ObjectPattern", properties: elts }) }
function arrPatt(elts) { return Pattern({ type: "ArrayPattern", elements: elts }); }
function objPatt(elts) { return Pattern({ type: "ObjectPattern", properties: elts }); }
function localSrc(src) { return "(function(){ " + src + " })" }
function localPatt(patt) { return program([exprStmt(funExpr(null, [], blockStmt([patt])))]) }
function blockSrc(src) { return "(function(){ { " + src + " } })" }
function blockPatt(patt) { return program([exprStmt(funExpr(null, [], blockStmt([blockStmt([patt])])))]) }
function localSrc(src) { return "(function(){ " + src + " })"; }
function localPatt(patt) { return program([exprStmt(funExpr(null, [], blockStmt([patt])))]); }
function blockSrc(src) { return "(function(){ { " + src + " } })"; }
function blockPatt(patt) { return program([exprStmt(funExpr(null, [], blockStmt([blockStmt([patt])])))]); }

@@ -279,6 +279,6 @@ function assertBlockStmt(src, patt) {

assertExpr("(x && y)", logExpr("&&", ident("x"), ident("y")));
assertExpr("(w || x || y || z)", logExpr("||", logExpr("||", logExpr("||", ident("w"), ident("x")), ident("y")), ident("z")))
assertExpr("(w || x || y || z)", logExpr("||", logExpr("||", logExpr("||", ident("w"), ident("x")), ident("y")), ident("z")));
assertExpr("(x ? y : z)", condExpr(ident("x"), ident("y"), ident("z")));
assertExpr("(x,y)", seqExpr([ident("x"),ident("y")]))
assertExpr("(x,y,z)", seqExpr([ident("x"),ident("y"),ident("z")]))
assertExpr("(x,y)", seqExpr([ident("x"),ident("y")]));
assertExpr("(x,y,z)", seqExpr([ident("x"),ident("y"),ident("z")]));
assertExpr("(a,b,c,d,e,f,g)", seqExpr([ident("a"),ident("b"),ident("c"),ident("d"),ident("e"),ident("f"),ident("g")]));

@@ -285,0 +285,0 @@ assertExpr("(new Object)", newExpr(ident("Object"), []));

@@ -36,5 +36,6 @@ /*

// Special handling for regular expression literal since we need to
// convert it to a string literal, otherwise it will be decoded
// as object "{}" and the regular expression would be lost.
// Special handling for regular expression literals: remove their `value`
// property since it may be `null` if it represents a regular expression
// that is not supported in the current environment. The `regex` property
// will be compared instead.
function adjustRegexLiteral(key, value) {

@@ -118,3 +119,3 @@ 'use strict';

'use strict';
var expected, tree, actual, options, StringObject, i, len, err;
var expected, tree, actual, options, StringObject, i, len;

@@ -157,3 +158,3 @@ // alias, so that JSLint does not complain.

syntax = sortedObject(syntax);
expected = JSON.stringify(syntax, null, 4);
expected = JSON.stringify(syntax, adjustRegexLiteral, 4);
try {

@@ -259,3 +260,3 @@ // Some variations of the options.

// If handleInvalidRegexFlag is true, an invalid flag in a regular expression
// will throw an exception. In some old version V8, this is not the case
// will throw an exception. In some old version of V8, this is not the case
// and hence handleInvalidRegexFlag is false.

@@ -281,3 +282,3 @@ handleInvalidRegexFlag = false;

if (tokenize) {
esprima.tokenize(code, options[i])
esprima.tokenize(code, options[i]);
} else {

@@ -350,5 +351,3 @@ esprima.parse(code, options[i]);

tick,
expected,
index,
len;
expected;

@@ -355,0 +354,0 @@ function setText(el, str) {

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