Skip to content

Instantly share code, notes, and snippets.

@gshutler
Forked from trullock/gist:3302433
Created August 9, 2012 09:00
Show Gist options
  • Save gshutler/3302481 to your computer and use it in GitHub Desktop.
Save gshutler/3302481 to your computer and use it in GitHub Desktop.
var compare = function (a, b) {
var i = 0;
for (; i < a.length; i++) {
if (a[i] != b[i]) {
return (a[i] > b[i]) ? 1 : -1;
}
}
return 0;
};
return compare(a, b) * sortDir;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment