Socket
Socket
Sign inDemoInstall

wikidata-person

Package Overview
Dependencies
39
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    wikidata-person

Node library for querying People using the Wikidata API


Version published
Weekly downloads
1
decreased by-80%
Maintainers
1
Install size
1.72 MB
Created
Weekly downloads
 

Readme

Source

Wikidata Person Querier

NPM Version Build Status

A JavaScript library for querying People using the Wikidata API.

Installation

NPM

npm install wikidata-person

Yarn

yarn add wikidata-person

Usage

Get a Person from Wikipedia


var wdp = require('wikidata-person');

wdp.person("Mohandas Karamchand Gandhi", function(person) {
    console.log(person);
});

The above code will log:

        {
            name:"Mahatma Gandhi",
            description:"pre-eminent leader of Indian nationalism during British-ruled India",
            birthdate: 1869,
            deathdate: 1948
        }

Get an array of Persons from a Wikipedia Category

require('wikidata-person').category(<category>) takes in the name of a Wikipedia Category and returns a list of all people who belong to the <category> or its subcategories.


var wdp = require('wikidata-person');

wdp.category("2nd-century_Roman_usurpers", function(people) {
    console.log(person);
});

The above code will log:

        [
            {
                name: 'Avidius Cassius',
                description: 'Roman consul',
                birthdate: '+0130',
                deathdate: '+0175'
            },
            {
                name: 'Clodius Albinus',
                description: 'Roman usurper proclaimed emperor by the legions in Britain and Hispania',
                birthdate: '+0150',
                deathdate: '+0197'
            }
        ]

Warnings

If the number of category members exceeds the Wikidata API's cmlimit, the returned list of people will not be complete.

Querying a huge category containing a large amount of people (for example, Category:People), the query may not complete.

Tests

npm test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Keywords

FAQs

Last updated on 01 Apr 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc