abstract-syntax-tree
Advanced tools
Comparing version 2.15.0 to 2.15.1
# abstract-syntax-tree changelog | ||
## 2.15.1 | ||
* add: iife method (static) | ||
## 2.15.0 | ||
@@ -4,0 +8,0 @@ |
@@ -23,2 +23,3 @@ const find = require('./src/find') | ||
const program = require('./src/program') | ||
const iife = require('./src/iife') | ||
@@ -106,2 +107,6 @@ class AbstractSyntaxTree { | ||
static iife (body) { | ||
return iife(body) | ||
} | ||
constructor (source = '', options = {}) { | ||
@@ -108,0 +113,0 @@ if (typeof source === 'string') { |
{ | ||
"name": "abstract-syntax-tree", | ||
"version": "2.15.0", | ||
"version": "2.15.1", | ||
"description": "abstract syntax tree", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
104
README.md
@@ -14,2 +14,3 @@ # abstract-syntax-tree | ||
- [REPL](https://buxlabs.pl/en/tools/js/ast) | ||
- [Nodes](#nodes) | ||
- [Optimizations](#optimizations) | ||
@@ -376,2 +377,12 @@ - [Maintainers](#maintainers) | ||
#### iife | ||
Creates an abstract syntax tree for an immediately invoked function expression. | ||
```js | ||
const { iife } = require('abstract-syntax-tree') | ||
const node = iife() // { type: 'ExpressionStatement', expression: { ... } } | ||
``` | ||
### Instance Methods | ||
@@ -472,2 +483,95 @@ | ||
## Nodes | ||
| Type | Example | | ||
|--------------------------|:---------------------------------:| | ||
| ArrayExpression | `const foo = []` | | ||
| ArrayPattern | `const [foo, bar] = bar` | | ||
| AssignmentExpression | `foo = bar` | | ||
| AssignmentOperator | | | ||
| AssignmentPattern | `function foo(bar = baz) {} ` | | ||
| AwaitExpression | `(async () => { await foo() })()` | | ||
| BigIntLiteral | | | ||
| BinaryExpression | `foo + bar` | | ||
| BinaryOperator | | | ||
| BlockStatement | `{ console.log(foo) }` | | ||
| BreakStatement | `for (foo in bar) break` | | ||
| CallExpression | | | ||
| CatchClause | | | ||
| ChainElement | | | ||
| ChainExpression | | | ||
| Class | | | ||
| ClassBody | | | ||
| ClassDeclaration | | | ||
| ClassExpression | | | ||
| ConditionalExpression | | | ||
| ContinueStatement | | | ||
| DebuggerStatement | | | ||
| Declaration | | | ||
| Directive | | | ||
| DoWhileStatement | | | ||
| EmptyStatement | | | ||
| ExportAllDeclaration | | | ||
| ExportDefaultDeclaration | | | ||
| ExportNamedDeclaration | | | ||
| ExportSpecifier | | | ||
| Expression | | | ||
| ExpressionStatement | | | ||
| ForInStatement | | | ||
| ForOfStatement | | | ||
| ForStatement | | | ||
| Function | | | ||
| FunctionBody | | | ||
| FunctionDeclaration | | | ||
| FunctionExpression | | | ||
| Identifier | | | ||
| IfStatement | | | ||
| ImportDeclaration | | | ||
| ImportDefaultSpecifier | | | ||
| ImportExpression | | | ||
| ImportNamespaceSpecifier | | | ||
| ImportSpecifier | | | ||
| LabeledStatement | | | ||
| Literal | | | ||
| LogicalExpression | | | ||
| LogicalOperator | | | ||
| MemberExpression | | | ||
| MetaProperty | | | ||
| MethodDefinition | | | ||
| ModuleDeclaration | | | ||
| ModuleSpecifier | | | ||
| NewExpression | | | ||
| Node | | | ||
| ObjectExpression | | | ||
| ObjectPattern | | | ||
| Pattern | | | ||
| Position | | | ||
| Program | | | ||
| Property | | | ||
| RegExpLiteral | | | ||
| RestElement | | | ||
| ReturnStatement | | | ||
| SequenceExpression | | | ||
| SourceLocation | | | ||
| SpreadElement | | | ||
| Statement | | | ||
| Super | | | ||
| SwitchCase | | | ||
| SwitchStatement | | | ||
| TaggedTemplateExpression | | | ||
| TemplateElement | | | ||
| TemplateLiteral | | | ||
| ThisExpression | | | ||
| ThrowStatement | | | ||
| TryStatement | | | ||
| UnaryExpression | | | ||
| UnaryOperator | | | ||
| UpdateExpression | | | ||
| UpdateOperator | | | ||
| VariableDeclaration | | | ||
| VariableDeclarator | | | ||
| WhileStatement | | | ||
| WithStatement | | | ||
| YieldExpression | | | ||
## Optimizations | ||
@@ -474,0 +578,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
982186
132
17651
969