File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ const blocks = {
1212const jsonify = ( stringWithJSON : string ) : JSON => {
1313 try {
1414 return JSON . parse ( stringWithJSON )
15- } catch ( _err ) {
15+ } catch ( err ) {
16+ console . info ( 'JSON parse failed: cleanup' , err )
1617 stringWithJSON = stringWithJSON
1718 . replace ( / ( [ a - z A - Z 0 - 9 _ $ ] + \s * ) : / g, '"$1":' )
1819 . replace ( / ' ( [ ^ ' ] + ?) ' ( [ \s , \] } ] ) / g, '"$1"$2' )
@@ -90,7 +91,9 @@ const extractJSONFromString = (str: string): any[] => {
9091 try {
9192 let obj = jsonify ( result )
9293 objects . push ( obj )
93- } catch ( _err ) { }
94+ } catch ( err ) {
95+ console . error ( err )
96+ }
9497
9598 str = str . replace ( result , '' )
9699 }
Original file line number Diff line number Diff line change 11{
22 "name" : " @airthium/extract-json-from-string" ,
33 "description" : " Extract JSON/javascript objects from strings" ,
4- "version" : " 1.0.86 " ,
4+ "version" : " 1.0.87 " ,
55 "main" : " dist/index.js" ,
66 "type" : " module" ,
77 "scripts" : {
You can’t perform that action at this time.
0 commit comments