Skip to content

Commit

Permalink
docs: fix oxc-parser README demo error (#1993)
Browse files Browse the repository at this point in the history
The type of `ret.program` is `string`, it need to parse it first to get
the `body`.
  • Loading branch information
luhc228 authored Jan 11, 2024
1 parent d51c9f1 commit b1de10f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions npm/oxc-parser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const oxc = require("oxc-parser");
const assert = require('assert');

function test(ret) {
assert(ret.program.body.length == 1);
const program = JSON.parse(ret.program);
assert(program.body.length == 1);
assert(ret.errors.length == 0);
}

Expand All @@ -31,7 +32,8 @@ import oxc from 'oxc-parser';
import assert from 'assert';

function test(ret) {
assert(ret.program.body.length == 1);
const program = JSON.parse(ret.program);
assert(program.body.length == 1);
assert(ret.errors.length == 0);
}

Expand Down

0 comments on commit b1de10f

Please sign in to comment.