UNPKG

supergeneric

Version:

Supergeneric JS helper functions... formatters, math functions, sort functions, etc.

2 lines (1 loc) 152 B
"use strict";exports.sortBy=function(t,{descending:n=!1}={}){const e=n?1:-1,o=-e;return"function"==typeof t?(n,s)=>t(n)<t(s)?e:o:(n,s)=>n[t]<s[t]?e:o};