super-dictionary

Zero-Dependency All-Language Dictionary Wrapper for Dictionary API

Usage no npm install needed!

<script type="module">
  import superDictionary from 'https://cdn.skypack.dev/super-dictionary';
</script>

README

super-dictionary

Documentation

npm version npm downloads license npm bundle size

Zero-Dependency All-Language API Wrapper for Dictionary API

Installation

npm i super-dictionary

Methods

const dictionary = require('super-dictionary');

// as an async promise
async function run() {
    let data = await dictionary.getDefinition('hello');
    console.log(data);
}

// as a callback
dictionary.getSynonyms('nice').then(synonyms => {
    console.log(synonyms)
})

Example Output

getDefinition(word, language?)

Can return an array of definitions with their part of speech or a simple definition
[
  { pos: 'exclamation', definition: [ [Object] ] },
  { pos: 'noun', definition: [ [Object] ] },
  { pos: 'verb', definition: [ [Object] ] }
]

getSynonyms(word, language?)

Can return an array of synonyms with their definition counterparts or an object of one synonym with its definition
[
  {
    num: 0,
    type: 'giving pleasure or satisfaction; pleasant or attractive.',
    synonyms: [
      'enjoyable',       'pleasant',
      'pleasurable',     'agreeable',
      'delightful',      'satisfying',
      'gratifying',      'acceptable',
      "to one's liking", 'entertaining',
      'amusing',         'diverting',
      'marvellous',      'good',
      'bonny',           'couthy',
      'irie',            'lovely',
      'great',           'neat',
      'lekker',          'mooi'
    ]
  },
  {
    num: 1,
    type: '(especially of a difference) slight or subtle.',
    synonyms: [
      'subtle',     'fine',
      'delicate',   'minute',
      'precise',    'exact',
      'accurate',   'strict',
      'close',      'careful',
      'meticulous', 'rigorous',
      'scrupulous', 'ultra-fine'
    ]
  },
  { num: 2, type: 'fastidious; scrupulous.', synonyms: [] }
]

etc...