UNPKG

ut2

Version:

一个现代 JavaScript 实用工具库。[点击查看在线文档]。

26 lines (23 loc) 662 B
import toNumber from '../toNumber.js'; function createOperation(comparator) { return function (value, other) { if (!(typeof value === 'string' && typeof other === 'string')) { value = toNumber(value); other = toNumber(other); } return comparator(value, other); }; } var baseGt = function (value, other) { return value > other; }; var baseGte = function (value, other) { return value >= other; }; var baseLt = function (value, other) { return value < other; }; var baseLte = function (value, other) { return value <= other; }; export { baseGt, baseGte, baseLt, baseLte, createOperation };