SHARE
TWEET

Untitled

a guest Jul 21st, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sortstuff(data,ascending, sortKey=0){
  2.   let key = sortKey || Object.keys(data[0])[0]
  3.   return data.sort(function(a,b) {
  4.     if ( a[key] < b[key] )
  5.         return ascending ? -1 : 1;
  6.     if ( a[key] > b[key] )
  7.         return ascending ? 1 : -1;
  8.     return 0;
  9.     } );
  10. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top