mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
docs: fix oxc-parser README demo error (#1993)
The type of `ret.program` is `string`, it need to parse it first to get the `body`.
This commit is contained in:
parent
d51c9f19f9
commit
b1de10fbfd
1 changed files with 4 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue