New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

defs

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defs - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

tests/named-function-expression-conservative-error-stderr

25

build/es5/defs-main.js

@@ -88,13 +88,3 @@ "use strict";

// There's no block-scope under it
// Function name goes in parent scope
if (node.id) {
// if (node.type === "FunctionExpression") {
// console.dir(node.id);
// }
// assert(node.type === "FunctionDeclaration"); // no support for named function expressions yet
assert(node.id.type === "Identifier");
node.$parent.$scope.add(node.id.name, "fun", node.id, null);
}
node.$scope = new Scope({

@@ -106,2 +96,17 @@ kind: "hoist",

// function has a name
if (node.id) {
assert(node.id.type === "Identifier");
if (node.type === "FunctionDeclaration") {
// Function name goes in parent scope for declared functions
node.$parent.$scope.add(node.id.name, "fun", node.id, null);
} else if (node.type === "FunctionExpression") {
// Function name goes in function's scope for named function expressions
node.$scope.add(node.id.name, "fun", node.id, null);
} else {
assert(false);
}
}
node.params.forEach(function(param) {

@@ -108,0 +113,0 @@ node.$scope.add(param.name, "param", param, null);

9

CHANGES.md

@@ -0,8 +1,11 @@

## v0.4.1 2013-07-28
* Bugfix named function expressions (issue #12)
## v0.4 2013-07-10
* defs became self aware
* NPM package includes (and defaults to) the self-transpiled version
* Bugfix renaming of index-expressions such as arr[i] (issue #10)
* Bugfix renaming of index-expressions such as `arr[i]` (issue #10)
## v0.3 2013-07-05
* defs used as a library returns errors collected to ret.errors instead
of writing to stderr. This also deprecates ret.exitcode.
* defs used as a library returns errors collected to `ret.errors` instead
of writing to stderr. This also deprecates `ret.exitcode`

@@ -88,13 +88,3 @@ "use strict";

// There's no block-scope under it
// Function name goes in parent scope
if (node.id) {
// if (node.type === "FunctionExpression") {
// console.dir(node.id);
// }
// assert(node.type === "FunctionDeclaration"); // no support for named function expressions yet
assert(node.id.type === "Identifier");
node.$parent.$scope.add(node.id.name, "fun", node.id, null);
}
node.$scope = new Scope({

@@ -106,2 +96,17 @@ kind: "hoist",

// function has a name
if (node.id) {
assert(node.id.type === "Identifier");
if (node.type === "FunctionDeclaration") {
// Function name goes in parent scope for declared functions
node.$parent.$scope.add(node.id.name, "fun", node.id, null);
} else if (node.type === "FunctionExpression") {
// Function name goes in function's scope for named function expressions
node.$scope.add(node.id.name, "fun", node.id, null);
} else {
assert(false);
}
}
node.params.forEach(function(param) {

@@ -108,0 +113,0 @@ node.$scope.add(param.name, "param", param, null);

{
"name": "defs",
"version": "0.4.0",
"version": "0.4.1",
"description": "Static scope analysis and transpilation of ES6 block scoped const and let variables, to ES3.",

@@ -5,0 +5,0 @@ "main": "build/es5/defs-main.js",

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