react-native-oxford-dictionary

1.0.2 • Public • Published

react-native-oxford-dictionary

React Native node module wrapper for Oxford Dictionary API. Inspired by oxford-dictionary

Install:

    npm install react-native-oxford-dictionary

Setup:

  const Dictionary = require("react-native-oxford-dictionary");
  
  const config = {
    app_id : "YOUR_OXFORD_ACCOUNT_APP_ID",
    app_key : "YOUR_OXFORD_ACCOUNT_APP_KEY",
    source_lang : "en-us" // default: en-us
  };
  
  const dict = new Dictionary(config);

Usage:

  const define = dict.find("cool");

  define.then((res) => {
      // stringify JSON object to see full structure in console log
      console.log(JSON.stringify(res, null, 4));
  },
  (err) => {
      console.log(err);
  });

Methods:

Useful methods.

.find

.find retrieves available dictionary entries for a given word and language.

  const define = dict.find("cool");

.definitions

.definitions retrieves available dictionary entries for given word and language and returns the definitions.

  const define = dict.definitions("cool");

.inflections

.inflections retrieves available lemmas for a given inflected wordform.

  const define = dict.inflections("cool");

.pronunciations

.pronunciations retrieves available dictionary entries for given word and language and returns the pronunciation.

  const define = dict.pronunciations("cool");

.examples

.examples retrieves available dictionary entries for given word and language and returns only examples.

  const define = dict.examples("cool");

.synonyms

.synonyms retrieves available synonyms for a given word and language.

  const define = dict.synonyms("cool");

.antonyms

.antonyms retrieves available antonyms for a given word and language.

  const define = dict.antonyms("cool");

.sentences

.sentences retrieves list of sentences and list of senses (English language only).

  const define = dict.sentences("cool");

Package Sidebar

Install

npm i react-native-oxford-dictionary

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

6.63 kB

Total Files

4

Last publish

Collaborators

  • bayram96