Skip to content

Performs a permutation of the input string and returns only valid English words that can be formed from the letters

Notifications You must be signed in to change notification settings

ThePlatinum/english-permutation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Performs a permutation of the input string and returns only valid English words that can be formed from the letters

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published