npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-definer

v1.0.1

Published

A dictionaryapi.com proxy. Make requests to dictionaryapi.com to define words using their collegiate api, and get synonyms/antonyms with their thesaurus api

Downloads

15

Readme

Definer is a proxy utility for communicating with dictionaryapi.com to quickly define word[s] in your prefered CLI, primarly as a TUI (Text User Interface).

Simply install, add your api key and start defining!

  1. > npm install -g node-definer

  2. > node-definer --setup

  3. > node-definer onomatopoeia
    
    onomatopoeia ⌜noun⌟ ⨳ on*o*mato*poe*ia
    pronounced: ˌä-nə-ˌmä-tə-ˈpē-ə
    / onomatopoeia; onomatopoeias; onomatopoeic; onomatopoeically; onomatopoetic; onomatopoetically /
    ∘ the naming of a thing or action by a vocal imitation of the sound associated with it (such as buzz, hiss); also : a word formed by onomatopoeia
    ∘ the use of words whose sound suggests the sense
    
    ? Select an option for more info or press CTRL+C to quit
    (Use arrow keys)
    > speak

There are 3 possible actions to execute after defining a word:

  • speak: plays the pronounciation in your default browser
  • synonyms: displays a list of synonyms
  • antonyms: displays a list of antonyms

Note: synonyms and antonyms are only provided if you also include a thesaurus api key during setup

Your requests are cached in a sqlite database so that you don't exhaust your api quota on requests you've made in the past

Programatically define words

Though this package is intended to be largely used via a CLI, there is some minimal support for importing a Definer class to define words.

The difference in the lightweight class support is that it will only return the response matches as-is, if any. It will not pretty format anything and it will also not include thesaurus support, even if you provide an api key in the CLI setup.

This is intentional, because often most defined words have multiple meanings, or matches, so it's uncertain which one[s] you need synonyms/antonyms for.

There is no need to perpetually exhaust your api quota limit to retrieve them all for 'just-in-case'

An example:

const Definer = require('node-definer');

const definer = new Definer('<collegiate api key>');

definer.define('onomatopoeia')
       .then(matches => console.log(matches[0]))
       .catch(console.log);

//logs
ApiResponseMatch {
  headwordinfo: ApiResponseMatchHeadwordInfo {
    headword: 'on*o*mato*poe*ia',
    pronounciations: [
      [ApiResponseMatchPronounciation],
      [ApiResponseMatchPronounciation]
    ],
    alternates: []
  },
  labels: ApiResponseMatchLabels {
    functional: 'noun',
    general: [],
    parenthesized: null
  },
  definitions: ApiReponseMatchDefinition {
    shortdefs: [
      'the naming of a thing or action by a vocal imitation of the sound associated with it (such as buzz, hiss); also : a word formed by onomatopoeia',
      'the use of words whose sound suggests the sense'
    ]
  },
  id: 'onomatopoeia',
  query: 'onomatopoeia',
  uuid: '32bb5182-d079-4291-aff2-c3ad25b3779f',
  stems: [
    'onomatopoeia',
    'onomatopoeias',
    'onomatopoeic',
    'onomatopoeically',
    'onomatopoetic',
    'onomatopoetically'
  ],
  date: 'circa 1553{ds||1||}'
}