diff --git a/npm/oxc-parser/README.md b/npm/oxc-parser/README.md index 7788d3d6f2c8b..06b85a4ceb3cb 100644 --- a/npm/oxc-parser/README.md +++ b/npm/oxc-parser/README.md @@ -1,29 +1,22 @@ # The JavaScript Oxidation Compiler -See index.d.ts for `parseSync` and `parseAsync` API. - -## ESM +See `index.d.ts` for `parseSync` and `parseAsync` API. ```javascript import assert from 'assert'; import oxc from 'oxc-parser'; -function test(ret) { - const program = JSON.parse(ret.program); - assert(program.body.length == 1); - assert(ret.errors.length == 0); -} - const sourceText = "let foo: Foo = 'foo';"; -const options = { - sourceFilename: 'text.tsx', // the extension is used to determine which dialect to parse -}; +// Filename extension is used to determine which +// dialect to parse source as +const options = { sourceFilename: 'text.tsx' }; test(oxc.parseSync(sourceText, options)); +test(await oxc.parseAsync(sourceText, options)); -async function main() { - test(await oxc.parseAsync(sourceText, options)); +function test(ret) { + const program = JSON.parse(ret.program); + assert(program.body.length == 1); + assert(ret.errors.length == 0); } - -main(); ```