Socket
Socket
Sign inDemoInstall

collins

Package Overview
Dependencies
47
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    collins

Collins English Dictionary asynchronous API for Node.js


Version published
Weekly downloads
15
increased by650%
Maintainers
1
Install size
3.72 MB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 13 Aug 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc