Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_createRelationalOperation.js 578B

1234567891011121314151617181920
  1. var toNumber = require('./toNumber');
  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. module.exports = createRelationalOperation;