Skip to content

Instantly share code, notes, and snippets.

View sandy912's full-sized avatar
🏠
Working from home. Frontend Developer

Santhosh Sandy sandy912

🏠
Working from home. Frontend Developer
View GitHub Profile
@ecarter
ecarter / mapOrder.js
Created December 2, 2011 15:40
Order an array of objects based on another array order
/**
* Sort array of objects based on another array
*/
function mapOrder (array, order, key) {
array.sort( function (a, b) {
var A = a[key], B = b[key];