super-dictionary
v1.0.3
Published
Zero-Dependency All-Language Dictionary Wrapper for Dictionary API
Downloads
9
Maintainers
Readme
super-dictionary
Documentation
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...