Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does lodash have gt, lt, gte, lte functions?

Is there any interesting use for these functions that can be helpful instead of just using the comparison operators? For example, https://lodash.com/docs/4.17.10#gte

I am just wondering if there is a value in these functions that I am missing since it does not make sense (at least for me) to include them in a library.

like image 775
Cemre Mengü Avatar asked May 04 '18 20:05

Cemre Mengü


1 Answers

Functions can be passed as arguments or chained with other functions; operators cannot.

This makes those "operator" functions composable, amenable to a more functional approach.

like image 188
Dave Newton Avatar answered Nov 19 '22 23:11

Dave Newton