english-permutation

2.0.1 • Public • Published

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

Package Sidebar

Install

npm i english-permutation

Weekly Downloads

1

Version

2.0.1

License

MIT

Unpacked Size

2.82 MB

Total Files

7

Last publish

Collaborators

  • platinum-emmanuel