Created
September 8, 2020 23:31
-
-
Save wopian/8639e5d24119cbd99548b73c18321686 to your computer and use it in GitHub Desktop.
Linguist Languages Without Colours
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node --experimental-json-modules linguist | |
// The JSON data is converted from the following YAML file: | |
// https://github.com/github/linguist/blob/master/lib/linguist/languages.yml | |
import languageDump from './languages.json' | |
const languages = [] | |
const languagesWithoutColour = [] | |
const caseInsensitiveSort = (a, b) => a.language.localeCompare(b.language) | |
// Object of Objects to Array of Objects | |
for(const language in languageDump) { | |
if(languageDump.hasOwnProperty(language)) { | |
const item = languageDump[language] | |
item.language = language | |
languages.push(item) | |
} | |
} | |
languages.forEach(language => { | |
if (!language.color) languagesWithoutColour.push(language) | |
}) | |
languagesWithoutColour.sort(caseInsensitiveSort).forEach(({ language, group }) => { | |
const groupText = group ? ` (grouped in \`${group}\`)` : `` | |
console.log(`- [ ] ${language}${groupText}`) | |
}) | |
console.log(`\n${languages.length - languagesWithoutColour.length} languages have a language`) | |
console.log(`${languagesWithoutColour.length} languages do not have a colour\n`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment