2.0.1 • Published 1 year ago

english-permutation v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

english-permutation

npm npm

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.

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