Files
tauri-toml/parse-string.js
2018-06-14 04:05:24 -07:00

19 lines
413 B
JavaScript

'use strict'
module.exports = parseString
const TOMLParser = require('./lib/toml-parser.js')
const prettyError = require('./parse-pretty-error.js')
function parseString (str) {
if (global.Buffer && global.Buffer.isBuffer(str)) {
str = str.toString('utf8')
}
const parser = new TOMLParser()
try {
parser.parse(str)
return parser.finish()
} catch (ex) {
throw prettyError(ex, str)
}
}