Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #30 from ft-interactive/minor-changes
Browse files Browse the repository at this point in the history
Sort words alphabetically in json file
  • Loading branch information
Sumeet Adur committed Dec 8, 2015
2 parents 88d1079 + 2f626a8 commit e60bc44
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ gulp.task('download-data', () => fetch(SPREADSHEET_URL)

let slugIndex = wordArray.sort();

const sortedWords = {};

for (const word of wordArray) {
sortedWords[word] = words[word];
}

for (const row of spreadsheet) {
let currentSlug = row.slug;

Expand Down Expand Up @@ -303,7 +309,7 @@ gulp.task('download-data', () => fetch(SPREADSHEET_URL)
}
}

fs.writeFileSync('client/words.json', JSON.stringify(words, null, 2));
fs.writeFileSync('client/words.json', JSON.stringify(sortedWords, null, 2));

let dateIndex = wordArray.sort(function (a, b) {
return new Date(words[b].submissiondate) - new Date(words[a].submissiondate);
Expand Down

0 comments on commit e60bc44

Please sign in to comment.