0.1.0 • Published 6 years ago
safely-parse-json v0.1.0
Parse JSON safely
const safe = require('safely-parse-json');
const value = '{ "one": "one" }';
const result = safe(value, options); // value parsed
Options are,
checkString
: iftrue
will assume error ifvalue
is not string default:true
returnError
: iftrue
will also return error, and result will be of from{ value, error }
default:false
nullOnError
: iftrue
will not return the original value on error, will return null instead default:false
0.1.0
6 years ago