english-permutation
v2.0.1
Published
Performs a permutation of the input string and returns only valid English words that can be formed from the letters
Downloads
6
Maintainers
Readme
english-permutation
Performs a permutation of the input string and returns only valid English words that can be formed from the letters
Installation
yarn add english-permutation
or
npm install english-permutation
How to use
import permutate from 'english-permutation'
console.log(await permutate('ABS'));
# result will be a promise that resolves to an array:
[ 'ABS', 'BAS', 'SAB' ]
An empty search will return null
as a string
Breaking Change
The package now produces a promise that resolves to the result. You should use it as such in you code to await the result.
Contributions
Contributions are welcome via Pull Requests on Github.
- Please document any change you made as neccesary in the README.md.
- Pleas make only one pull request per feature/fix. Please check the Possible Upcoming improvements
Issues
Please report any issue you encounter in using the package through the issues tab Github Issues
Possible Upcoming improvements:
- Implement a limit on the number of permutations generated to prevent the algorithm from generating too many permutations and causing performance issues.
- Optimize the permutation algorithm.
- Use a more efficient data structure to store the permutations, maybe hash set instead of an array, as it allows for faster insertion, retrieval, and membership testing.
- Optimize the filter function by using a more efficient algorithm to match the regular expression, such as using a trie data structure to match the regular expression.
- Maybe Add words meaning (Make into a web API)
credits: atebits/words. for the list of English words