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

flast

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flast - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

2

package.json
{
"name": "flast",
"version": "1.2.3",
"version": "1.2.4",
"description": "Flatten JS AST",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -188,12 +188,2 @@ # flAST - FLat Abstract Syntax Tree

## Contribution
To contribute to this project see our [contribution guide](CONTRIBUTING.md)
## Changes
### v1.2.1
- Overhaul scoping to account for declarations with the same name in different scopes.
### v1.1.1
- Improve getParentKey to include parsing the name of grouped nodes such as 'arguments' or 'body'.
### v1.1.0
- Added parentKey property.
- Improved ASTNode definition (useful for intellisense).
- Ability to pass options directly to the espree parser.
To contribute to this project see our [contribution guide](CONTRIBUTING.md)

@@ -98,3 +98,3 @@ // noinspection JSUnusedGlobalSymbols

if (isDeclaration) node.references = node.references || [];
else {
else if (!(node.parentKey === 'id' && node.parentNode.type === 'FunctionDeclaration')) {
// Find declaration by finding the closest declaration of the same name.

@@ -101,0 +101,0 @@ let decls = [];

@@ -47,2 +47,21 @@ const assert = require('node:assert');

},
{
enabled: true,
name: 'Variable references are not confused with functions of the same name',
description: `Verify a function's identifier isn't treated as a reference.`,
run() {
const code = `function a() {
var a;
}`;
const ast = generateFlatAST(code);
const funcId = ast.find(n => n.name ==='a' && n.parentNode.type === 'FunctionDeclaration');
const varId = ast.find(n =>n.name ==='a' && n.parentNode.type === 'VariableDeclarator');
const functionReferencesFound = !!funcId.references?.length;
const variableReferencesFound = !!varId.references?.length;
assert(!functionReferencesFound,
`References to a function were incorrectly found. Got "${functionReferencesFound}" instead of "false"`);
assert(!variableReferencesFound,
`References to a variable were incorrectly found. Got "${variableReferencesFound}" instead of "false"`);
},
},
];
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