(text)
| 14 | }; |
| 15 | |
| 16 | function parseEmptyJson(text) { |
| 17 | const file = parse(text, babelParseOptions); |
| 18 | |
| 19 | const { program } = file; |
| 20 | |
| 21 | // Not an empty JSON |
| 22 | /* c8 ignore next */ |
| 23 | if (!( |
| 24 | program.body.length === 0 && |
| 25 | program.directives.length === 0 && |
| 26 | !program.interpreter |
| 27 | )) { |
| 28 | return; |
| 29 | } |
| 30 | |
| 31 | return { comments: file.comments }; |
| 32 | } |
| 33 | |
| 34 | function parseJson(text, options = {}) { |
| 35 | const { allowComments = true, allowEmpty = false } = options; |