Created
          October 2, 2012 08:35 
        
      - 
      
- 
        Save meeDamian/3817375 to your computer and use it in GitHub Desktop. 
    [ JS | LIBS ] Re-Sorting list on properties
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // LIBS: returns proper sorting function | |
| function sort_by( prop ) { | |
| return function(a,b) { | |
| return a[prop] - b[prop]; | |
| } | |
| } | |
| // USAGE: resort list on eid property | |
| list.sort( sort_by('eid') ); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment