node package manager

keysort

Sorts an Array of Objects with SQL ORDER BY clause

keysort

Sorts an Array of Objects based on key values, like an SQL ORDER BY

build status

Example

var arr = [{abc: 123124, xyz: 5}, {abc: 123124, xyz: 6}, {abc: 2, xyz: 5}];
 
keysort(arr, "abc"); // [{abc: 2, xyz: 5}, {abc: 123124, xyz: 5}, {abc: 123124, xyz: 6}]; 
keysort(arr, "abc, xyz desc"); // [{abc: 2, xyz: 5}, {abc: 123124, xyz: 6}, {abc: 123124, xyz: 5}]; 

What is Supported?

  • AMD loaders (require.js, cujo.js, etc.)
  • node.js (npm install keysort)
  • script tag

License

Copyright (c) 2013 Jason Mulligan
Licensed under the BSD-3 license.