-
-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
v10.10.1 Operator: contains
regression
#675
v10.10.1 Operator: contains
regression
#675
Comments
Hi @VictoriaHunsaker , thanks for the report. I'm not able to repro the results, the latest version here yields results same as Could you provide more information:
|
Hey, i'm working on the same project as @VictoriaHunsaker and dug into this a bit -- our issue is that we're passing in a wrapper value around user-provided string, to throw an explicit error if someone tries to use a non-numeric value for an operator like class StrictStringForLiquid {
private name: string;
private value: string;
constructor(name: string, value: string) {
this.name = name;
this.value = value;
}
toString() {
return this.value;
}
valueOf() {
const num = Number(this.value);
if (isNaN(num)) {
throw new Error(
`expected ${this.name} to be a number, but it was: "${this.value}"`
);
}
return num;
}
equals(other: unknown) {
return this.value === String(other);
}
gt(other: unknown) {
return this.valueOf() > Number(other);
}
geq(other: unknown) {
return this.valueOf() >= Number(other);
}
lt(other: unknown) {
return this.valueOf() < Number(other);
}
leq(other: unknown) {
return this.valueOf() <= Number(other);
}
indexOf(other: unknown) {
return this.value.indexOf(String(other));
}
} Note that Drops don't work for this use-case; the I think you could preserve backwards-compatibility by replacing the |
* fix: `contains` regression on string-like objects, #675 * chore: fix build docs on macos
Hello, I think the latest release (10.10.1) has introduced a bug in the
contains
operator.Given this template:
In 10.10.0, the result is
However, in 10.10.1, the result is
The text was updated successfully, but these errors were encountered: