mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Bump to v4.11.2.
This commit is contained in:
21
_createRelationalOperation.js
Normal file
21
_createRelationalOperation.js
Normal file
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
});
|
||||
Reference in New Issue
Block a user