Skip to content

Commit

Permalink
Simplify JSON trailing comment regular expression
Browse files Browse the repository at this point in the history
Not a huge change, but when it comes to regular expressions, every bit
of simplification helps—at least when it comes to readability, if not
performance.
  • Loading branch information
mbland committed Dec 30, 2023
1 parent 9763aa7 commit b53e3c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export function stripJsonComments(jsonStr) {
}
result += curChar
}
return result.replaceAll(/,(\s*)([\]}])/g, ' $1$2')
return result.replaceAll(/,(\s*[\]}])/g, ' $1')
}

/**
Expand Down

0 comments on commit b53e3c6

Please sign in to comment.