mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
31 lines
575 B
JavaScript
31 lines
575 B
JavaScript
/**
|
|
* 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 gte, lt, lte
|
|
* @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 = +value
|
|
other = +other
|
|
}
|
|
return value > other
|
|
}
|
|
|
|
export default gt
|