Installation

You can use NPM:

npm install word-exists --save

Or Yarn:

yarn add word-exists

Usage

Simply pass in a string as a parameter and a Boolean will be output.

const wordExists = require('wordExists');

wordExists('word');
//true

wordExists('notaword');
//false

Hyphenated compound words aren't counted as words.

Example Values

Word

Output

'hello' true
'olleh' false
'tic-tac-toe' false
9 TypeError

For more examples, see the tests.

Speed Tests

3 iterations of each of the below tests are run. In each iteration, the function is run 1,000 times.

wordExists('amphidiploidies') //Run 1,000 times
    wordExists('zooxanthellae') //Run 1,000 times
      wordExists('superlongstringthatisntevenaword') //Run 1,000 times

        The above speed tests are run as you load the page and will likely change if you reload the page.

        Author

        This package was created by Brandon Suen.