Huge News!Announcing our $40M Series B led by Abstract Ventures.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
  • Socket score

Version published
Maintainers
1
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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc