Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use consistent quotes that don't need to be escaped #9234

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Ge-limin
Copy link

@Ge-limin Ge-limin commented Jan 29, 2024

fixes #4112

@@ -209,23 +209,26 @@ export function fieldFilterExpression(predicate: FieldPredicate, useInRange = tr
: rawFieldExpr;

if (isFieldEqualPredicate(predicate)) {
return `${fieldExpr}===${predicateValueExpr(predicate.equal, unit)}`;
const equal = predicate.equal;
return `${fieldExpr} === ${predicateValueExpr(equal, unit)}`;
Copy link
Member

Choose a reason for hiding this comment

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

Let's change spacing in a separate pull request.

} else if (isFieldValidPredicate(predicate)) {
return fieldValidPredicate(fieldExpr, predicate.valid);
const valid = predicate.valid;
return fieldValidPredicate(fieldExpr, valid);
Copy link
Member

Choose a reason for hiding this comment

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

Not really a need to define a variable for one use.

}

function escapePathAccess(string: string) {
return string.replace(/(\[|\]|\.|'|")/g, '\\$1');
}

function doubleQuotes2Single(string: string) {
Copy link
Member

Choose a reason for hiding this comment

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

No, we can't do this. It's too brittle and possibly introduces errors. If we want to change the quotes, we need to extend stringValue to accept a quote parameter.

@domoritz domoritz changed the title fix: use consistent predicate output format (#4112) feat: use consistent quotes that don't need to be escaped Feb 19, 2024
@domoritz
Copy link
Member

Are you still working on this?

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.

Use consistent predicate output format
2 participants