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

etymo-js

v1.0.1

Published

NodeJS and browser util for fetching etymology results from https://www.etymonline.com

Downloads

4

Readme

Etymo

A NodeJS and browser wrapper for fetching etymology information in various langauges from Douglas Harper's wonderful Online Etymology Dictionary (https://www.etymonline.com)

Please refer to Online Etymology Dictionary's Terms of Service to make sure you are not infringing intellectual property rights with your use case, and please be kind to their servers.

Get started

Add etymo-js to your Node project

npm install etymo-js
import { Etymo } from "etymo-js";
// initialize
const etymo = new Etymo();

async function run() {
  const results = await etymo.search("remember");
  console.log(results);
}

run();

Returns an array of search results, with the first item being most relevant:

[
      {
        "term": "remember (v.)",
        "def": "mid-14c., remembren, \"keep or bear (something or someone) in mind, retain in the memory, preserve unforgotten,\" from Old French remembrer [...]",
        "path": "/word/disremember#etymonline_v_11486",
        "id": "11486"
      },
      {
        "term": "*(s)mer- (1)",
        "def": "Proto-Indo-European root meaning \"to remember.\" \n' +
          'It forms all or part of: commemorate; commemoration; mourn; memo; memoir; memorable; memorandum; memorial [...]"
        "path": "/word/*%28s%29mer-#etymonline_v_53458",
        "id": "53458"
      },
      {
        "term": "remembrance (n.)",
        "def": "c. 1300, remembraunce, \"a memory, recollection,\" from Old French remembrance (11c.), from remembrer (see remember). From late 14c. as \"consideration, reflection; present consciousness [...]",
        "path": "/word/remembrance#etymonline_v_37059",
        "id": "37059"
      } ...
      ]

Usage

Note - requires internet connection to retrieve data.

.search()

Basic search

Returns array of search result obejcts ({ term, def, path, id}), ordered by relevance to search term

const res = await etymo.search("remember");
[
    {
    "term": "remember (v.)",
    "def": "mid-14c., remembren, \"keep or bear (something or someone) in mind, retain in the memory, preserve unforgotten,\" from Old French remembrer [...]",
    "path": "/word/disremember#etymonline_v_11486",
    "id": "11486"
    }, ...
]

Multi-word search

It's fine to use spaces in the search term

const res = await etymo.search("back seat");
[
  {
    "term": "back seat (n.)",
    "def": "also back-seat, 1832, originally of coaches, from back (adj.) + seat (n.). Used figuratively for \"less or least prominent position\" by 1868. Back-seat driver \"passenger who gives the driver unwanted advice\" is [...]",
    "path": "/word/back%20seat#etymonline_v_42318",
    "id": "42318"
  }, ...
]

.get() entry by path

You can use any of the paths returned from search to get single entries. You can also specifify the language of the definition returned.

Returns a single entry ({ term, def, path, id})

get English definition

const res = await etymo.get("/word/remember#etymonline_v_10402");
{
  "term": "remember (v.)",
  "def": "mid-14c., remembren, \"keep or bear (something or someone) in mind, retain in the memory, preserve unforgotten,\" from Old French remembrer \"remember, recall, bring to mind\" (11c.), from Latin rememorari \"recall to mind, remember,\" from re- \"again\" (see re-) + memorari \"be mindful of, [...]",
  "path": "/word/remember#etymonline_v_10402",
  "id": "10402"
}

get definition in another language

You can specify an option lang parameter . See avaialable languages below. Note that the lang parameter will override any language pre-pended in the provided path.

// get definition in Japanese
const res = await etymo.get("/word/remember#etymonline_v_10402", {
  lang: "jp",
});
{
  "term": "remember (v.)",
  "def": "14世紀中頃、remembren は、「(何かや誰かを)心に留める、記憶に保つ、忘れないようにする」という意味で使われました。これは、古フランス語の remembrer「思い出す、思い起こす」(11世紀)から来ており、ラテン語の rememorari「思い出す、記憶する」から派生したものです。これは、re-「再び」(re- を参照) [...]",
  "path": "/word/remember#etymonline_v_10402",
  "id": "10402"
}

Supported languages | Language | Two-Letter Code | |-------------|-----------------| | English | en | | Spanish | es | | French | fr | | German | de | | Italian | it | | Portuguese | pt | | Japanese | ja | | Chinese | zh | | Korean | ko |

.trending()

Returns a list of terms currently trending on etymonline.com

const res = await etymo.trending();

// => ['nepotism','nickelodeon','hero','island','ego','fast','spell','gospel','father','confidence']

Development

Package created with @el3um4s/typescript-npm-package-starter

Ignore the TS errors in the test file 🤷 Jest doesn't seem to care.

Build the package

Run

npm run build

Test the package

You can test the code with Jest

npm test

You can find the test coverage in coverage/lcov-report/index.html.

Check dependencies

You can check and upgrade dependencies to the latest versions, ignoring specified versions. with npm-check-updates:

npm run check-updates

You can also use npm run check-updates:minor to update only patch and minor.

Instead npm run check-updates:patch only updates patch.

Publish

First commit the changes to GitHub. Then login to your NPM account (If you don’t have an account you can do so on https://www.npmjs.com/signup)

npm login

Then run publish:

npm publish

If you're using a scoped name use:

npm publish --access public

Bumping a new version

To update the package use:

npm version patch

and then

npm publish