1.0.1 • Published 9 months ago

homophones v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Homophones Finder

A utility to find homophones of a given word using the Datamuse API.

Installation

npm install homophones

Usage

Basic Usage

const HomophonesFinder = require('homophones');

const finder = new HomophonesFinder();

finder.find('bear').then(homophones => {
    console.log(homophones);  // e.g., ['bear', 'bare']
});

Advanced Usage

(Remember that records have to match the response interface HomophoneResponse, which is derived from the Datamuse API.)

If you want to provide a custom fetcher or set a different API endpoint:

const HomophonesFinder, { ApiFetcher } = require('homophones');

const customFetcher = new ApiFetcher('https://customapi.com');
const finder = new HomophonesFinder(customFetcher);

finder.find('lead').then(homophones => {
    console.log(homophones);  // e.g., ['lead', 'led']
});

Running Tests

Before running the tests, ensure you've installed the necessary dev dependencies:

npm install

Then, run the tests:

npm test
1.0.1

9 months ago

1.0.0

9 months ago