UNPKG
json-try-parse
Version:
latest (1.0.0)
1.0.0
try to parse json or return undefined
json-try-parse
/
index.js
12 lines
(8 loc)
•
145 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
'use strict'
;
module
.
exports
=
function
tryParse
(
data
) {
var
json;
try
{ json =
JSON
.
parse
(data); }
catch
(ex) {}
return
json; };