Skip to content

Commit 97a3579

Browse files
committed
[RELEASE] v1.0.87
1 parent 8911dad commit 97a3579

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/extract-json-from-string.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const blocks = {
1212
const 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-zA-Z0-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
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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": {

0 commit comments

Comments
 (0)