Skip to content

Commit

Permalink
Cleans up left-over log and optmize regex match
Browse files Browse the repository at this point in the history
Signed-off-by: Matus Majchrak <[email protected]>
  • Loading branch information
matus-m committed Aug 11, 2019
1 parent 4686931 commit 4b61e23
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ const jsonObjectOrArrayStartRegex = /^(\[|\{)/;

function parseIfComplexJson(value: any) {
// if the value is a string representing actual json object or array, then use json-markup
if (typeof value === 'string' && value.match(jsonObjectOrArrayStartRegex)) {
if (typeof value === 'string' && jsonObjectOrArrayStartRegex.test(value)) {
// otherwise just return as is
try {
console.log('parsing JSON');
return JSON.parse(value);
// eslint-disable-next-line no-empty
} catch (_) {}
Expand Down

0 comments on commit 4b61e23

Please sign in to comment.