2121 * [ ` Options ` ] ( #options )
2222 * [ ` Plugin ` ] ( #plugin )
2323 * [ ` Value ` ] ( #value )
24- * [ ` Version ` ] ( #version )
24+ * [ ` Version ` ] ( #version-1 )
2525* [ Types] ( #types )
2626* [ Compatibility] ( #compatibility )
2727* [ Contribute] ( #contribute )
@@ -45,7 +45,7 @@ It turns the tree into a string of JavaScript.
4545## Install
4646
4747This package is [ ESM only] [ esm ] .
48- In Node.js (version 14.14+ or 16.0+), install with [ npm] [ ] :
48+ In Node.js (version 14.14+ and 16.0+), install with [ npm] [ ] :
4949
5050``` sh
5151npm install esast-util-from-js
@@ -54,14 +54,14 @@ npm install esast-util-from-js
5454In Deno with [ ` esm.sh ` ] [ esmsh ] :
5555
5656``` js
57- import {fromJs } from " https://esm.sh/esast-util-from-js@1"
57+ import {fromJs } from ' https://esm.sh/esast-util-from-js@1'
5858```
5959
6060In browsers with [ ` esm.sh ` ] [ esmsh ] :
6161
6262``` html
6363<script type =" module" >
64- import {fromJs } from " https://esm.sh/esast-util-from-js@1?bundle"
64+ import {fromJs } from ' https://esm.sh/esast-util-from-js@1?bundle'
6565 </script >
6666```
6767
@@ -117,12 +117,12 @@ Yields:
117117
118118## API
119119
120- This package exports the identifier ` fromJs ` .
120+ This package exports the identifier [ ` fromJs ` ] [ fromjs ] .
121121There is no default export.
122122
123123### ` fromJs(value[, options]) `
124124
125- Parse a JavaScript ( ` string ` or ` Buffer ` in UTF-8) to an esast ( [ ` Node ` ] [ node ] ) .
125+ Parse JavaScript to an esast.
126126
127127###### Parameters
128128
@@ -133,13 +133,15 @@ Parse a JavaScript (`string` or `Buffer` in UTF-8) to an esast ([`Node`][node]).
133133
134134###### Returns
135135
136- Tree (` Program ` ).
136+ Tree ([ ` Node ` ] [ node ] ).
137137
138138### ` Options `
139139
140140Configuration (TypeScript type).
141141
142- ###### ` options.version `
142+ ##### Fields
143+
144+ ###### ` version `
143145
144146JavaScript version ([ ` Version ` ] [ version ] , default: ` 'latest' ` ).
145147
@@ -150,34 +152,34 @@ When a number, must be a year in the range `2015` and `2022` (both including).
150152> breaking semver.
151153> Pass an actual year to lock that down.
152154
153- ###### ` options. module`
155+ ###### ` module `
154156
155157Whether this is a module (ESM) or a script (` boolean ` , default: ` false ` ).
156158
157- ###### ` options. allowReturnOutsideFunction`
159+ ###### ` allowReturnOutsideFunction `
158160
159161Whether a return statement is allowed in the top scope (` boolean ` , default:
160162` false ` ).
161163
162- ###### ` options. allowImportExportEverywhere`
164+ ###### ` allowImportExportEverywhere `
163165
164166Whether import/export statements are allowed in the every scope (` boolean ` ,
165167default: ` false ` ).
166168
167- ###### ` options. allowAwaitOutsideFunction`
169+ ###### ` allowAwaitOutsideFunction `
168170
169171Whether ` await ` is allowed in the top scope (` boolean ` , default: depends).
170172Defaults to ` version >= 2022 ` .
171173
172- ###### ` options. allowSuperOutsideMethod`
174+ ###### ` allowSuperOutsideMethod `
173175
174176Whether ` super ` is allowed outside methods (` boolean ` , default: ` false ` ).
175177
176- ###### ` options. allowHashBang`
178+ ###### ` allowHashBang `
177179
178180Whether a shell hasbang is allowed (` boolean ` , default: ` false ` ).
179181
180- ###### ` options. plugins`
182+ ###### ` plugins `
181183
182184List of acorn plugins ([ ` Array<Plugin> ` ] [ plugin ] , default: ` [] ` ).
183185Examples are [ ` acorn-jsx ` ] [ acorn-jsx ] and [ ` acorn-stage3 ` ] [ acorn-stage3 ] .
@@ -217,7 +219,8 @@ type Version = 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest'
217219## Types
218220
219221This package is fully typed with [TypeScript][].
220- It exports the additional types ` Options ` , ` Plugin ` , ` Value ` , and ` Version ` .
222+ It exports the additional types [ ` Options ` ][options], [ ` Plugin ` ][plugin],
223+ [ ` Value ` ][value], and [ ` Version ` ][version].
221224
222225## Compatibility
223226
@@ -306,10 +309,12 @@ abide by its terms.
306309
307310[estree-util-to-js]: https://github.com/syntax-tree/estree-util-to-js
308311
312+ [fromjs]: #fromjsvalue-options
313+
309314[options]: #options
310315
311316[plugin]: #plugin
312317
313318[value]: #value
314319
315- [version]: #version
320+ [version]: #version-1
0 commit comments