a6506c6f16d8be8754487ec56bf4c5d5623c0fd9ea6f31de4445542e047aa3bb8bb621605a9853f99bc0e26be1e07c6eb311f7730e771644e1fa64429ad1d8 576 B

1234567891011121314151617181920
  1. import toNumber from './toNumber.js';
  2. /**
  3. * Creates a function that performs a relational operation on two values.
  4. *
  5. * @private
  6. * @param {Function} operator The function to perform the operation.
  7. * @returns {Function} Returns the new relational operation function.
  8. */
  9. function createRelationalOperation(operator) {
  10. return function(value, other) {
  11. if (!(typeof value == 'string' && typeof other == 'string')) {
  12. value = toNumber(value);
  13. other = toNumber(other);
  14. }
  15. return operator(value, other);
  16. };
  17. }
  18. export default createRelationalOperation;