mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Consolidate relational modules.
This commit is contained in:
11
gt.js
11
gt.js
@@ -1,5 +1,4 @@
|
||||
import baseGt from './.internal/baseGt.js';
|
||||
import createRelationalOperation from './.internal/createRelationalOperation.js';
|
||||
import toNumber from './toNumber.js';
|
||||
|
||||
/**
|
||||
* Checks if `value` is greater than `other`.
|
||||
@@ -22,6 +21,12 @@ import createRelationalOperation from './.internal/createRelationalOperation.js'
|
||||
* gt(1, 3);
|
||||
* // => false
|
||||
*/
|
||||
const gt = createRelationalOperation(baseGt);
|
||||
function gt(value, other) {
|
||||
if (!(typeof value == 'string' && typeof other == 'string')) {
|
||||
value = toNumber(value);
|
||||
other = toNumber(other);
|
||||
}
|
||||
return value > other;
|
||||
}
|
||||
|
||||
export default gt;
|
||||
|
||||
Reference in New Issue
Block a user