don't bring out the heavy json parse just to check a string#42
don't bring out the heavy json parse just to check a string#42
Conversation
|
Found 4 violations: Reporter: ESLint Expected comment to be above code. (line-comment-position)
Reporter: ESLint Expected comment to be above code. (line-comment-position)
Reporter: ESLint Unexpected any. Specify a different type. (@typescript-eslint/no-explicit-any)
Reporter: ESLint Unexpected any. Specify a different type. (@typescript-eslint/no-explicit-any)
|
|
|
||
| export function evaluateToBool(expr: string, ctx: object): boolean { | ||
| return JSON.parse(evaluateToString(expr, ctx).toLowerCase()) | ||
| const result = evaluateToString(expr, ctx).toLowerCase().trim() |
There was a problem hiding this comment.
Is there a measurable performance impact in making this change, and if so, what is that measurement?
also throw an exception if we don't get the boolean type we want