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

wikifakt

v1.0.3

Published

Get random facts from Wikipedia

Downloads

34

Readme

wikifakt

Build Status

Generate a random fact from Wikipedia. All facts will be short, 1-3 sentences long. This api also allows you to get a random Wikipedia article title.

Examples

Random facts

  • Fermana Football Club is an Italian association football club, based in Fermo, Marche. It currently plays in Serie D.
  • James Anthony Piersall (born November 14, 1929) is an American former baseball center fielder who played 17 seasons in Major League Baseball (MLB) for five teams, from 1950 through 1967. Piersall is best known for his well-publicized battle with bipolar disorder that became the subject of the book and movie Fear Strikes Out.
  • Hypercompe eridanus is a moth of the Arctiidae family. It is found in Colombia, Surinam and French Guiana.
  • Israel was represented in the Eurovision by David D'Or who sang the bilingual English / Hebrew song "Leha'amin" (Hebrew script: להאמין; English translation: "To Believe")
  • Charles Lemercier de Longpre, baron d'Haussez (20 October 1778, Neufchâtel-en-Bray (Normandy) – 10 November 1854, Saint-Saëns (Seine-Maritime)) was a French politician and minister.
  • Zalesie [zaˈlɛɕɛ] is a village in the administrative district of Gmina Wąsosz, within Grajewo County, Podlaskie Voivodeship, in north-eastern Poland. It lies approximately 7 kilometres (4 mi) east of Wąsosz, 14 km (9 mi) south of Grajewo, and 68 km (42 mi) north-west of the regional capital Białystok.

Random article titles

  • Boxing News
  • National Stadium (Palau)
  • Snood (anatomy)
  • Humane Order of African Redemption
  • David Rankin (cricketer)

Installation

npm i --save wikifakt

Usage

WikiFakt exposes two functions which return promises.

  • getRandomFact
  • getRandomRandomArticleTitle
var WikiFakt = require('wikifakt');

// Get a fact
WikiFakt.getRandomFact().then(function(fact) {
  console.log(fact);
});

// Get an article title
WikiFakt.getRandomArticleTitle().then(function(title) {
  console.log(title);
});

Preloading

Getting facts requires making two HTTP GET requests (one to get the random Wikipedia article, and a second to the Wikipedia api to get the content). Because of this, WikiFakt, by default, will preload facts. The first call to getRandomFact will actually fetch two facts and store the second for later use. Subsequent calls to getRandomFact will immediatly return the preloaded fact without needing to make any HTTP requests. In the background, after the fact has already been returned, a new fact will be fetched and preloaded. This will speed up getting facts from the API if you expect to be using it multiple times.

Preloading can be disabled with

WikiFakt.preload = false;