Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve language detection code and add new gitignore files #4

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

quamejnr
Copy link
Contributor

@quamejnr quamejnr commented Aug 4, 2023

What is this?

This is a an improved way of language detection function

Why this?

This ensures addition of more supported languages does not lead to modification of detectLanguage and getSupportedLanguages functions and new introduction of if else statements

How are you doing this?

  • All languages and their extensions have been put into a map (hash table) with the language as keys and the list of extensions as values.
  • detectLanguage loops through the extensions and return the first language it gets a match for.

Copy link
Owner

@hacktivist123 hacktivist123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite smart, LGTM, thanks man.

@hacktivist123 hacktivist123 merged commit 2dcd778 into hacktivist123:main Aug 4, 2023
@chuksgpfr chuksgpfr mentioned this pull request Aug 4, 2023
hacktivist123 added a commit that referenced this pull request Aug 6, 2023
Improve language detection code and add new gitignore files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants