Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Latest commit

 

History

History
35 lines (18 loc) · 3.97 KB

CONTRIBUTING.md

File metadata and controls

35 lines (18 loc) · 3.97 KB

Contribute

Welcome! Please feel free to contribute algorithms, issues, fixes, and translations.

Algorithms

There are a few steps to adding an algorithm to the repository. Please remember that all JavaScript algorithm and test contributions must follow JavaScript Standard Style rules. ES6+ code is suggested and fast implementations are preferable.

  1. Please create your JavaScript algorithm file inside the ES algorithms directory, following the camel-case naming convention used. The file should follow the same layout conventions inside the other algorithm files and have a comment header explaining what the function does and what parameters it expects.

  2. Add your algorithm export to es.js following conventions used to add the others. You need to add it to it's category object and export. Please maintain alphabetized organization.

  3. Create your algorithm's test file inside the ES test directory. The file should be named exactly the same as it is in the algorithms directory, but with the suffix "Tests" added. See the other tests for examples. Your test file should follow the same layout conventions inside other test files. There should be tests to cover success cases. Failure and edge cases as well where appropriate.

  4. Add your new algorithm to README.md following the same conventions used to describe other algorithms. If a new category of algorithms is necessary, add it following the same conventions as others.

  5. Optional - Update the README.md files inside subfolders in the locales directory to include your new algorithm (translated appropriately).

  6. If you didn't update the README.md files inside subfolders in the locales directory, create an issue that specifies locale translations for your new algorithm need to be added.

  7. Run yarn test or npm test to generate the ES5 algorithm versions, updated es5.js file, ES5 test files. Find and fix any JavaScript Standard Styling errors (if there aren't any the test won't break and will continue to run the Mocha/Chai test cases). Review your test's coverage stats. Once you're tests are passing and you've gotten good coverage on your ES algorithm version (>95%, ideally 100%) you're ready to make your commit and pull request. High test coverage on the ES5 algorithm may not be possible given the testing environment and changes made during the transpiling process.

  8. Create a pull request from your fork to the master branch following the pull request template guidelines.

Issues

Please format issues according to the issues template.

Fixes

Please format pull requests for fixes according to the pull request template.

Translations

To add a translation create a new directory following ISO 639-1 naming conventions. Inside the directory create a README.md file. The README.md file should imitate the English README.md file precisely in formatting and accurately in content in the translated language. Once your translation is ready and/or you're done making changes to existing translations, create a pull request following the pull request template to the master branch from your fork.