Skip to content

Commit

Permalink
Move sorting to the server
Browse files Browse the repository at this point in the history
  • Loading branch information
daleharvey committed Mar 1, 2012
1 parent af45bba commit 4b764d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/upmock-client
13 changes: 12 additions & 1 deletion upmock.node.js
Expand Up @@ -82,7 +82,18 @@ app.get('/fonts/', function(_err, res) {
var t2 = _.map(googleFonts.items, function(x) {
return {'id': x.family, 'family':x.family, 'source':'google'};
});
var result = t1.concat(t2);

var result = t1.concat(t2).sort(function(a, b) {
var nameA = a.family.toLowerCase();
var nameB = b.family.toLowerCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
});

fs.writeFile(__dirname + '/fonts.json', JSON.stringify(result), function(err) {
if (!err) {
Expand Down

0 comments on commit 4b764d7

Please sign in to comment.