0.1.1 • Published 5 years ago

en-etym v0.1.1

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

en-etym

Build Status

A tool for searching etymology of English words on https://www.etymonline.com/

Installation

npm i en-etym

Usage

const etym = require('en-etym')

API

etym.getEtym

(word: String) => Promise

Fetch etymology information of a word in an asynchronized way. The resolved value of the Promise is the array of etymology information.

const etym = require('en-etym')

etym.getEtym('glitter').then(etymList => console.log(JSON.stringify(etymList)))
// [{"title":"glitter (v.)","etymDict":{"Old Norse":["glitra"],"Proto-Germanic":["*glit-"],"Old English":["glitenian"],"PIE":["*ghleid-","*ghel-"],"Greek":["khlidon"]}}]

etym.getEtymSync

(word: String, callback: (etymList: Array) => any) => void

Fetch etymology information of a word in a synchronized way. The argument of the callback function is the array of etymology information.

const etym = require('en-etym')

etym.getEtymSync('glitter', etymList => console.log(JSON.stringify(etymList)))
// [{"title":"glitter (v.)","etymDict":{"Old Norse":["glitra"],"Proto-Germanic":["*glit-"],"Old English":["glitenian"],"PIE":["*ghleid-","*ghel-"],"Greek":["khlidon"]}}]