1.0.1 • Published 6 years ago

wikipedia-hyperlinks v1.0.1

Weekly downloads
3
License
MIT
Repository
-
Last release
6 years ago

wikipedia-hyperlinks

Give me a term and I'll give you a list of links found in its Wikipedia article

Installation

This module requires Node.js 8 or higher, because it uses async functions.

Install as a module for programmatic use in your JavaScript code:

npm i wikipedia-hyperlinks --save

Or install as a command-line tool:

npm i -g wikipedia-hyperlinks

Module Usage

The module exports a single async function which expects a search string:

const wh = require('wikipedia-hyperlinks')

wh('Pierre Curie').then(links => {
  console.log(links.slice(0, 10))

  // Paris
  // University of Paris
  // Radioactivity
  // Curie-Weiss law
  // Curie constant
  // Curie temperature
  // Piezoelectricity
  // Marie Skłodowska-Curie
  // Irène Joliot-Curie
})

If no match is found, an empty array is returned.

CLI Usage

If you install the module globally, you'll have a command called wikipedia-hyperlinks on your PATH, and another called wh for convenience.

Enter a term:

wh Pierre Curie | head

Paris
University of Paris
Radioactivity
Curie-Weiss law
Curie constant
Curie temperature
Piezoelectricity
Marie Skłodowska-Curie
Irène Joliot-Curie

Tests

npm install
npm test

Dependencies

  • cheerio: Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • got: Simplified HTTP requests
  • lodash: Lodash modular utilities.
  • minimist: parse argument options
  • urldecode: Decode url

Dev Dependencies

  • chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
  • mocha: simple, flexible, fun test framework
  • nixt: Simple and powerful testing for command-line apps
  • standard: JavaScript Standard Style
  • standard-markdown: Test your Markdown files for Standard JavaScript Style™

License

MIT