Comparison functions - misonou/waterpipe GitHub Wiki
Checks if the piped value is equal, or not equal, to the supplied argument. The comparison is done by its string representation.
{{foo}} ➜ bar
{{foo == bar}} ➜ true
{{foo != baz}} ➜ true
Checks if the piped value is more than, less than, more than or equal to, less than or equal to, or between the supplied argument(s).
Note: In constrast to the native comparison operator,
undefinedandnullare always less than any other values; and arrays are compared element by element recursively.
{{foo}} ➜ [1,3,5]
{{bar}} ➜ [1,3]
{{baz}} ➜ [2,4]
{{foo.0 < 3}} ➜ true
{{foo.0 between 0 2}} ➜ true
{{foo > bar}} ➜ true
{{foo > baz}} ➜ false
Checks if the string contains a substring or matches the given pattern.
Note: Any escape character (
\) in regular expression needs to be escaped itself. For example a valid regular expression/\w/gneeds to be written as/\\w/g.
{{"foobar" contains foo}} ➜ true
{{"foobar" like /^foo/i}} ➜ true
Checks if the string starts or ends with the given substring.
{{"foobar" ^= foo}} ➜ true
{{"foobar" $= bar}} ➜ true
Checks if the string is equal, or not equal, to the given string by case-insensitive comparison.
{{"foobar" ~= Foobar}} ➜ true
{{"foobar" !~= Foobar}} ➜ false