Urara-Blog/node_modules/.pnpm-store/v3/files/f5/0e49221b2611c1f29d649e1258c8655b0cb8a01461f47882ed58c6be7aa6f23e628706105c8fbbdca4f40846a30b0860dda0dd67a8e79d5f4620d490170ad6
2022-08-14 01:14:53 +08:00

20 lines
578 B
Text

var toNumber = require('./toNumber');
/**
* Creates a function that performs a relational operation on two values.
*
* @private
* @param {Function} operator The function to perform the operation.
* @returns {Function} Returns the new relational operation function.
*/
function createRelationalOperation(operator) {
return function(value, other) {
if (!(typeof value == 'string' && typeof other == 'string')) {
value = toNumber(value);
other = toNumber(other);
}
return operator(value, other);
};
}
module.exports = createRelationalOperation;