UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

12 lines (10 loc) 209 B
function compareValues(a, b, order) { if (a < b) { return order === 'asc' ? -1 : 1; } if (a > b) { return order === 'asc' ? 1 : -1; } return 0; } export { compareValues };