forked from lodash/lodash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gt.js
32 lines (30 loc) · 627 Bytes
/
gt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import toNumber from './toNumber.js';
/**
* Checks if `value` is greater than `other`.
*
* @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is greater than `other`,
* else `false`.
* @see lt
* @example
*
* gt(3, 1);
* // => true
*
* gt(3, 3);
* // => false
*
* gt(1, 3);
* // => false
*/
function gt(value, other) {
if (!(typeof value == 'string' && typeof other == 'string')) {
value = toNumber(value);
other = toNumber(other);
}
return value > other;
}
export default gt;