UNPKG

wordhippo

Version:

This unofficial WordHippo API uses [request](https://www.npmjs.com/package/request) to fetch HTML documents from wordhippo.com, then initializes jQuery on the response document body using [mu.js](https://www.npmjs.com/package/mu.js) (a convenient wrapper

33 lines (23 loc) 807 B
/* Test */ const WordHippo = require('.') /* this method includes all other methods so really only need to test this one. */ //WordHippo.getWord('stress').then(console.log).catch(console.error) WordHippo.definition('chair').then(console.log) // WordHippo.related('stress').then(words => { console.log(words) // }) WordHippo.opposites('productive').then(console.log) // /*(async() => { await WordHippo.sentences('empty') // })()*/ WordHippo.sentences('empty').then(console.log) // WordHippo.rhymes('slam').then(words => { console.log({ words }) console.log(`slam rhymes with ${words[0]} and ${words[1]}`) }) WordHippo.getWord('eat').then(meta => { console.log(meta) }) WordHippo.getWord('daily').then(meta => { console.log(meta) })