I am trying to write a simple node.js program that will take in a json5 file and convert it to a json file. I have found this https://www.npmjs.com/package/any-json which I believe will be useful.
This is the code I currently have...
const anyJson = require("any-json");
const str = await anyJson.encode({/* test comment */ "foo": "bar"}, 'json');
however it gives me this error...
const str = await anyJson.encode({/* test comment */ "foo": "bar"}, 'json');
(^^^^^ under the await)
SyntaxError: await is only valid in async function
Note: This exact code works in the npm runkit