UNPKG

rambda

Version:

Lightweight and faster alternative to Ramda with included TS definitions

17 lines (13 loc) 312 B
export function createCompareFunction(a, b, winner, loser) { if (a === b) { return 0 } return a < b ? winner : loser } export function ascend(getFunction) { return (a, b) => { const aValue = getFunction(a) const bValue = getFunction(b) return createCompareFunction(aValue, bValue, -1, 1) } }