-
-
Save brunosabot/8f7dcb1cb5f595b5c754b66c8423cbf8 to your computer and use it in GitHub Desktop.
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
const MAP_LANGUAGE = { | |
yml: "yaml", | |
Dockerfile: "docker", | |
eslintrc: "json", | |
js: "javascript", | |
ts: "typescript", | |
stylelintrc: "json", | |
prettierrc: "json", | |
}; | |
function getLanguage(inputLanguage: string | undefined) { | |
if (inputLanguage === undefined) return "text"; | |
if (inputLanguage in MAP_LANGUAGE) { | |
return MAP_LANGUAGE[inputLanguage as keyof typeof MAP_LANGUAGE]; | |
} | |
return inputLanguage; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment