qsu
Version:
qsu is a utility library that contains useful and frequently used functions. Start with your preferred language and the modern development environment.
1 lines • 235 B
JavaScript
export function sortByObjectKey(r,e,t=!1,o=!1){if(o){const o=new Intl.Collator([],{numeric:!0}),n=r.sort((r,t)=>o.compare(r[e],t[e]));return t?n.reverse():n}return r.sort((r,o)=>t?r[e]>o[e]?-1:r[e]<o[e]?1:0:r[e]<o[e]?-1:r[e]>o[e]?1:0)}