Files
lodash/_createRelationalOperation.js
John-David Dalton ccdfca5392 Bump to v4.11.2.
2016-04-21 07:00:59 -07:00

22 lines
612 B
JavaScript

define(['./toNumber'], function(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);
};
}
return createRelationalOperation;
});