Function
Static Public Summary | ||
public |
fromObject(_: *): * Converts a plain object to a {@link Node}.
|
|
public |
functionExpressionThunk(body: *, generator: *): * |
|
public |
identifier(name: string): Identifier Mangles name and makes an {@link Identifier}.
|
|
public |
Assigns `loc` to `ast` and returns it.
|
|
public |
mangleIdentifier(name: String): String Convert a name to a valid JavaScript identifier.
|
|
public |
member(object: Node, propertyName: string): MemberExpression Creates a member expression for `propertyName` in `object`,
using dot syntax (`a.b`) if possible, and falling back to `a['b']`.
|
|
public |
needsMangle(name: *): * `false` iff `name` is a valid JavaScript identifier.
|
|
public |
propertyIdOrLiteral(propertyName: string): Identifier | Literal An Identifier if propertyName is a valid JavaScript property name;
otherwise a Literal string.
|
|
public |
propertyNameOk(name: *): * `true` iff `name` can be used as a property name using dot syntax (`a.b`).
|
|
public |
Creates JavaScript source code from a {@link Node}.
|
|
public |
renderWithSourceMap(ast: Node, inFilePath: string, outFilePath: string): code: string, sourceMap: string Same as {@link render}, but with a source map as part of the output.
|
|
public |
singleCharLoc(pos: Pos): * Loc consisting of the character at `pos`.
|
|
public |
toStatement(ast: *): * Convert any {@link Node} into one that can be used as the content of a line.
|
|
public |
unmangle(name: *): * Undoes {@link mangleIdentifier}.
|
Static Public
public fromObject(_: *): * source
import fromObject from 'esast/src/fromJson.js'
Converts a plain object to a Node.
Params:
Name | Type | Attribute | Description |
_ | * |
Return:
* |
public functionExpressionThunk(body: *, generator: *): * source
import {functionExpressionThunk} from 'esast/src/util.js'
Params:
Name | Type | Attribute | Description |
body | * | ||
generator | * |
Return:
* |
public identifier(name: string): Identifier source
import {identifier} from 'esast/src/util.js'
Mangles name and makes an Identifier.
Params:
Name | Type | Attribute | Description |
name | string |
public loc(ast: Node, loc: Loc): * source
import {loc} from 'esast/src/util.js'
Assigns loc
to ast
and returns it.
Return:
* |
public mangleIdentifier(name: String): String source
import mangleIdentifier from 'esast/src/mangle-identifier.js'
Convert a name to a valid JavaScript identifier.
Params:
Name | Type | Attribute | Description |
name | String | Can be any string. |
public member(object: Node, propertyName: string): MemberExpression source
import {member} from 'esast/src/util.js'
Creates a member expression for propertyName
in object
,
using dot syntax (a.b
) if possible, and falling back to a['b']
.
public needsMangle(name: *): * source
import {needsMangle} from 'esast/src/mangle-identifier.js'
false
iff name
is a valid JavaScript identifier.
Params:
Name | Type | Attribute | Description |
name | * |
Return:
* |
public propertyIdOrLiteral(propertyName: string): Identifier | Literal source
import {propertyIdOrLiteral} from 'esast/src/util.js'
An Identifier if propertyName is a valid JavaScript property name; otherwise a Literal string.
Params:
Name | Type | Attribute | Description |
propertyName | string |
public propertyNameOk(name: *): * source
import {propertyNameOk} from 'esast/src/mangle-identifier.js'
true
iff name
can be used as a property name using dot syntax (a.b
).
Params:
Name | Type | Attribute | Description |
name | * |
Return:
* |
public render(ast: Node, options: object): * source
import render from 'esast/src/render.js'
Creates JavaScript source code from a Node.
Return:
* |
public renderWithSourceMap(ast: Node, inFilePath: string, outFilePath: string): code: string, sourceMap: string source
import {renderWithSourceMap} from 'esast/src/render.js'
Same as render, but with a source map as part of the output.
Return:
code: string, sourceMap: string |
public singleCharLoc(pos: Pos): * source
import {singleCharLoc} from 'esast/src/Loc.js'
Loc consisting of the character at pos
.
Params:
Name | Type | Attribute | Description |
pos | Pos |
Return:
* |
public toStatement(ast: *): * source
import {toStatement} from 'esast/src/util.js'
Convert any Node into one that can be used as the content of a line. (esast requires all expression lines to be wrapped with ExpressionStatement.)
Params:
Name | Type | Attribute | Description |
ast | * |
Return:
* |
public unmangle(name: *): * source
import {unmangle} from 'esast/src/mangle-identifier.js'
Undoes mangleIdentifier.
Params:
Name | Type | Attribute | Description |
name | * |
Return:
* |