🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

collins

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

collins

Collins English Dictionary asynchronous API for Node.js

2.0.1
latest
Source
npm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Collins

Collins English Dictionary asynchronous API for node.js

Install

npm install collins

Usage

var Collins = require('collins');
var serverName = 'api.collinsdictionary.com';
var accessKey = 'your access key';

var d = new Collins(serverName, accessKey);

/**
  * Get list of available dictionaries
  */
d.dictionaries(function(err, data) {
    console.log(data);
});

/**
  * Get a dictionary
  */
d.dictionary('english', function(err, data) {
    console.log(data);
});

/**
  * Search
  */
d.search('english', 'grape', function(err, data) {
    console.log(data);
});

/**
  * Get Did You Mean entries
  */
d.didYouMean('english', 'trape', function(err, data) {
    console.log(data);
});

/**
  * Get the first/best matching entry
  */
d.first('english', 'grape', 'xml', function(err, data) {
    console.log(data);
});

/**
  * Get an entry
  */
d.entry('english', 'the-grape_1', 'xml', function(err, data) {
    console.log(data);
});

/**
  * Get pronunciations
  */
d.pronunciation('english', 'grape_1', function(err, data) {
    console.log(body);
});

/**
 * Get nearby entries
 */
d.nearby('english', 'grape_1', function(err, data) {
    console.log(body);
});

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

Keywords

collins

FAQs

Package last updated on 13 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts