Closed
Description
I try to stringify
the readme example and then parse
it and it returns an error. Am I doing it wrong?
Script
import TOML from "@ltd/j-toml";
const test = TOML.stringify({
key: "value",
dotted: {
key: "value",
},
inlineTable: TOML.inline({ key: "value" }),
mix: {
key: "value",
table: TOML.Section({
key: "value",
}),
},
table: TOML.Section({
key: "value",
table: TOML.Section({
key: "value",
}),
}),
});
const rootTable = TOML.parse(test);
Returns
PS C:\Users\User Name\Files\My Project\app> node helpers/configFile.js
file:///C:/Users/User%20Name/Files/My%20Project/app/node_modules/@ltd/j-toml/index.mjs:2230
if ( typeof sourcePath!=='string' ) { throw TypeError$1('TOML.parse(source.path)'); }
^
TypeError: TOML.parse(source.path)
at parse (file:///C:/Users/User%20Name/Files/My%20Project/app/node_modules/@ltd/j-toml/index.mjs:2230:49)
at Module.parse (file:///C:/Users/User%20Name/Files/My%20Project/app/node_modules/@ltd/j-toml/index.mjs:2293:6)
at file:///C:/Users/User%20Name/Files/V%20Rising/app/helpers/configFile.js:38:24
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
at async loadESM (node:internal/process/esm_loader:85:5)
at async handleMainPromise (node:internal/modules/run_main:61:12)
Node.js v17.9.0