Collins
Collins English Dictionary asynchronous API for node.js
Install
npm install collins
Usage
var Collins = ;var serverName = 'api.collinsdictionary.com';var accessKey = 'your access key'; var d = serverName accessKey; /** * Get list of available dictionaries */d; /** * Get a dictionary */d; /** * Search */d; /** * Get Did You Mean entries */d; /** * Get the first/best matching entry */d; /** * Get an entry */d; /** * Get pronunciations */d; /** * Get nearby entries */d;
Collins API
c.dictionaries(callback)
c.dictionary(dictionaryCode, callback)
c.search(dictionaryCode, searchWord, pageSize, pageIndex, callback)
c.didYouMean(dictionaryCode, searchWord, entryNumber, callback)
c.first(dictionaryCode, searchWord, format, callback) format = html, xml
c.entry(dictionaryCode, entryId, format, callback)
c.pronunciation(dictionaryCode, entryId, lang, callback)
c.nearby(dictionaryCode, entryId, entryNumber, callback)
Tests
To run tests specify an access key and a base url in _config.js
like so:
module.exports = {
SERVER_NAME: 'api.collinsdictionary.com',
ACCESS_KEY: 'your access key'
};
inside test
directory, then run:
mocha
License
MIT