diff --git a/index.js b/index.js index 1db1294..152c70e 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,18 @@ const getTemplate = require('./lib/get-template') const generateResult = require('./lib/generate-result') const languages = require('./lib/data/languages.json') +function languageSort (a, b) { + if (a.text < b.text) { + return -1 + } + if (a.text > b.text) { + return 1 + } + return 0 +} + +languages.sort(languageSort) + module.exports = data => { if (!data) { throw new Error('Missing required input') diff --git a/tst.js b/tst.js deleted file mode 100644 index e3795f5..0000000 --- a/tst.js +++ /dev/null @@ -1,18 +0,0 @@ -const { getTemplate, getInfo } = require('./index') - -const template = getTemplate('no') - -function repackFacet (prev, current) { - prev[current.facet] = current - return prev -} - -const repackedTemplate = template.reduce((prev, current) => { - const facets = current.facets.reduce(repackFacet, {}) - current.facets = facets - prev[current.domain] = current - return prev -}, {}) - -console.log(JSON.stringify(repackedTemplate, null, 2)) -console.log(getInfo())