@genexus/web-standard-functions
Version:
GeneXus JavaScript standard functions library for web generators
34 lines • 945 B
JavaScript
import { like } from "../text/like";
/**
* Compares the two operands using the indicated operator
* @param {any} left First operand
* @param {string} op Operator
* @param {any} right Second operand
* @return true if the comparition succeds, false otherwise
*/
export const compare = (left, op, right) => {
switch (op) {
case "<":
return left < right;
case "<=":
return left <= right;
case ">":
return left > right;
case ">=":
return left >= right;
case "=":
return left === right;
case "<>":
return left !== right;
case "like":
if (typeof left === "string" && typeof right === "string") {
return like(left, right);
}
else {
return false;
}
default:
return false;
}
};
//# sourceMappingURL=compare.js.map