Skip to content

Commit

Permalink
Fix problem where object literal expressions wouldn't get correctly p…
Browse files Browse the repository at this point in the history
…arsed
  • Loading branch information
runem committed Nov 9, 2019
1 parent 8d456c1 commit c3fe025
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/analyze/util/resolve-node-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function resolveNodeValue(node: Node | undefined, context: Context): stri
try {
// Try to parse object literal expressions as JSON by converting it to something parsable
const regex = /([a-zA-Z1-9]*?):/gm;
const json = node.getText().replace(regex, m => `"${m[0]}":`);
const json = node.getText().replace(regex, (fullGroup, groupMatch) => `"${groupMatch}":`);
return JSON.parse(json);
} catch {
// If something crashes it probably means that the object is more complex.
Expand Down

0 comments on commit c3fe025

Please sign in to comment.