Skip to content

don't bring out the heavy json parse just to check a string#42

Open
seifertk wants to merge 1 commit intomasterfrom
eval-to-bool-error
Open

don't bring out the heavy json parse just to check a string#42
seifertk wants to merge 1 commit intomasterfrom
eval-to-bool-error

Conversation

@seifertk
Copy link
Collaborator

also throw an exception if we don't get the boolean type we want

@github-actions
Copy link

Found 4 violations:

Reporter: ESLint
Rule: eslint.rules.line-comment-position
Severity: WARN
File: src/flow-spec/IBlock.ts L167

Expected comment to be above code. (line-comment-position)

Reporter: ESLint
Rule: eslint.rules.line-comment-position
Severity: WARN
File: src/flow-spec/IBlock.ts L162

Expected comment to be above code. (line-comment-position)

Reporter: ESLint
Rule: eslint.rules.@typescript-eslint/no-explicit-any
Severity: WARN
File: src/flow-spec/IBlock.ts L92

Unexpected any. Specify a different type. (@typescript-eslint/no-explicit-any)

Reporter: ESLint
Rule: eslint.rules.@typescript-eslint/no-explicit-any
Severity: WARN
File: src/flow-spec/IBlock.ts L89

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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a measurable performance impact in making this change, and if so, what is that measurement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants