Skip to content

Commit

Permalink
chore(npm/oxc-parser): update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Dec 3, 2024
1 parent 4eb87ea commit adee0d1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions npm/oxc-parser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import assert from 'assert';
import oxc from 'oxc-parser';

const sourceText = "let foo: Foo = 'foo';";
// Filename extension is used to determine which
// dialect to parse source as
const options = { sourceFilename: 'text.tsx' };
// Filename extension is used to determine which dialect to parse source as.
const filename = "test.tsx";

test(oxc.parseSync(sourceText, options));
test(await oxc.parseAsync(sourceText, options));
test(oxc.parseSync(filename, sourceText, options));
test(await oxc.parseAsync(filename, sourceText, options));

function test(ret) {
assert(ret.program.body.length == 1);
Expand Down

0 comments on commit adee0d1

Please sign in to comment.