We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ce0013 commit 88b6b15Copy full SHA for 88b6b15
package.json
@@ -1,6 +1,6 @@
1
{
2
"name": "json-to-js-obj",
3
- "version": "1.0.3",
+ "version": "1.0.5",
4
"description": "A utility to remove comments from JSON and return javascript object",
5
"main": "dist/index.js",
6
"module": "dist/index.mjs",
src/utility/json-to-object.ts
@@ -6,7 +6,7 @@
*/
7
const jsonPharse = (json: string): any => {
8
try {
9
-
+
10
if (typeof json !== 'string') throw new Error('argument is not string');
11
12
// remove comments
@@ -23,7 +23,8 @@ const jsonPharse = (json: string): any => {
23
return jsObj;
24
}
25
catch (error: any) {
26
- return console.log(`\x1b[31m${error.message}\x1b[0m`)
+ console.log(`\x1b[31m${error.message}\x1b[0m`);
27
+ throw new Error();
28
29
};
30
0 commit comments