0
2020-10-20 05:04:18 +00:00

19 lines
327 B
JavaScript

module.exports = SafeParseCallback
function SafeParseCallback(obj, reviver, callback) {
if (arguments.length === 2) {
callback = reviver
reviver = null
}
var json
try {
json = JSON.parse(obj, reviver)
} catch (err) {
return callback(err)
}
callback(null, json)
}