3.0.0 • Published 6 years ago

mw-dict v3.0.0

Weekly downloads
8
License
MIT
Repository
-
Last release
6 years ago

mw-dict

Node.js Wrapper for Merriam Webster Dictionary Developer API

  • Supports Collegiate® Dictionary & Learner's Dictionary
  • Supports Collegiate® Thesaurus
  • Exports word senses with hierarchy (sense, subsense...)
  • Outputs pronunciation audio url
  • Cares about functional label, synonyms, verbal illustrations ...
  • Outputs popularity

Preview:

'screen shot'

Note: Please get your API Key from Merriam-Webster's Developer Center

install

npm install mw-dict

usage

import { CollegiateDictionary, LearnersDictionary } from 'mw-dict'

const dict = new CollegiateDictionary(API_KEY)
// const dict = new LearnersDictionary(API_KEY)

dict
  .lookup(QUERY_WORD)
  .then(result => {})
  .catch(error => {})

result interface

// result: Definition[]
// Definition
{
  word: String,
  functional_label: String,
  pronunciation: String[],
  definition: Sense[],
  popularity: String
}
// Sense
{
  number: String,
  meanings: String[],
  synonyms: String[],
  antonyms: String[],
  illustrations: String[],
  senses: Sense[]
}

Error handler

import { WordNotFoundError } from 'mw-dict'

dict
  .lookup(QUERY_WORD)
  .catch(error => {
    if (error instanceof WordNotFoundError) {
      // error.suggestion
    }
  })
3.0.0

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago