@total-order/reversed
Version:
Comparison function reversion for JavaScript
1 lines • 562 B
Source Map (JSON)
{"version":3,"file":"index.cjs","sources":["../src/reversed.js"],"sourcesContent":["/**\n * Compile a new comparison function whose underlying total order is the\n * reverse of the input comparison function's underlying total order.\n *\n * @param {Function} compare The comparison function to reverse.\n * @return {Function} A function f such that compare(a,b) === f(b,a) for all a,b.\n */\nconst reversed = (compare) => (a, b) => compare(b, a);\nexport default reversed;\n"],"names":["compare","a","b"],"mappings":"iBAOiB,SAACA,mBAAaC,EAAGC,UAAMF,EAAQE,EAAGD"}