Skip to content

Commit

Permalink
docs: goldstein: parse: estree
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Oct 3, 2023
1 parent 69830fe commit fb66b8d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function hello() {

You can declare variables with [`@putout/operator-declare`](https://github.com/coderaiser/putout/tree/master/packages/operator-declare).

### `parse(source)`
### `parse(source, {type, keywords})`

When you need to get **JavaScript** Babel AST use `parse`:

Expand All @@ -163,6 +163,22 @@ parse(`
// returns Babel AST
```

You can parse to **ESTree**:
```
const options = {
type: 'estree',
};
parse(`
fn hello() {
guard text !== "world" else {
return ""
}
return "Hello " + text
`, options);
```

## Keywords

**Goldstein** is absolutely compatible with JavaScript, and it has extensions.
Expand Down

0 comments on commit fb66b8d

Please sign in to comment.