Socket
Socket
Sign inDemoInstall

wikipedia

Package Overview
Dependencies
9
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.5 to 1.0.6

11

dist/index.d.ts
import { pageOptions, searchOptions, geoOptions, listOptions, eventOptions } from './optionTypes';
import Page from './page';
import { coordinatesResult, eventResult, geoSearchResult, imageResult, langLinksResult, languageResult, wikiMediaResult, wikiSearchResult, wikiSummary } from './resultTypes';
import { coordinatesResult, eventResult, geoSearchResult, imageResult, langLinksResult, languageResult, mobileSections, relatedResult, title, wikiMediaResult, wikiSearchResult, wikiSummary } from './resultTypes';
/**

@@ -116,3 +116,3 @@ * The default wiki export

*/
related(title: string, pageOptions?: pageOptions | undefined): Promise<Array<wikiSummary>>;
related(title: string, pageOptions?: pageOptions | undefined): Promise<relatedResult>;
/**

@@ -248,3 +248,10 @@ * Gets the list of media items (images, audio, and video) in the

onThisDay(eventOptions?: eventOptions): Promise<eventResult>;
/**
* Returns a random page
*
* @param format - The desired return format
* @returns Returns content from a random page
*/
random(format?: "summary" | "related" | "title" | "mobile-sections" | "mobile-sections-lead" | undefined): Promise<wikiSummary | title | relatedResult | mobileSections | string>;
};
export default wiki;

@@ -519,2 +519,21 @@ "use strict";

};
/**
* Returns a random page
*
* @param format - The desired return format
* @returns Returns content from a random page
*/
wiki.random = async (format) => {
try {
if (!format) {
format = 'summary';
}
const path = `page/random/${format}`;
const result = await request_1.makeRestRequest(path);
return result;
}
catch (error) {
throw new Error(error);
}
};
exports.default = wiki;

@@ -521,0 +540,0 @@ // For CommonJS default export support

@@ -27,1 +27,2 @@ export interface searchOptions {

export declare type eventTypes = 'all' | 'selected' | 'births' | 'deaths' | 'events' | 'holidays';
export declare type randomFormats = 'title' | 'summary' | 'related' | 'mobile-sections' | 'mobile-sections-lead';

8

dist/page.d.ts

@@ -1,2 +0,2 @@

import { coordinatesResult, imageResult, langLinksResult, pageResult, wikiMediaResult, wikiSummary } from './resultTypes';
import { coordinatesResult, imageResult, langLinksResult, pageResult, relatedResult, wikiMediaResult, wikiSummary } from './resultTypes';
import { listOptions, pageOptions } from './optionTypes';

@@ -31,3 +31,3 @@ export declare class Page {

_intro: string;
_related: Array<wikiSummary>;
_related: relatedResult;
_media: wikiMediaResult;

@@ -183,3 +183,3 @@ constructor(response: pageResult);

*/
related: (pageOptions?: pageOptions | undefined) => Promise<Array<wikiSummary>>;
related: (pageOptions?: pageOptions | undefined) => Promise<relatedResult>;
/**

@@ -360,3 +360,3 @@ * Gets the list of media items (images, audio, and video) in the

*/
export declare const related: (title: string, redirect?: boolean) => Promise<Array<wikiSummary>>;
export declare const related: (title: string, redirect?: boolean) => Promise<relatedResult>;
/**

@@ -363,0 +363,0 @@ * Gets the list of media items (images, audio, and video) in the

@@ -53,2 +53,4 @@ export interface wikiSearchResult {

export interface wikiSummary {
ns?: number;
index?: number;
type: string;

@@ -116,6 +118,3 @@ title: string;

type: string;
caption?: {
html: string;
text: string;
};
caption?: htmlText;
showInGallery: boolean;

@@ -154,1 +153,71 @@ srcset: Array<srcResult>;

}
export interface titleItem {
title: string;
page_id: number;
rev: number;
tid: number;
namespace: number;
user_id: number;
user_text: string;
timestamp: string;
comment: string;
tags: Array<string>;
restrictions: Array<string>;
page_language: string;
redirect: boolean;
}
export interface title {
items: Array<titleItem>;
}
export interface relatedResult {
pages: Array<wikiSummary>;
}
export interface mobileSections {
lead: {
ns: number;
id: number;
revision: string;
lastmodified: string;
lastmodifier: {
user: string;
gender: string;
};
displaytitle: string;
normalizedtitle: string;
wikibase_item: string;
description: string;
description_source: string;
protection: Record<string, unknown>;
editable: boolean;
languagecount: number;
image: {
file: string;
urls: {
320: string;
640: string;
800: string;
1024: string;
};
};
issues: Array<htmlText>;
geo?: {
latitude: string;
longitude: string;
};
sections: Array<section>;
};
remaining: {
sections: Array<section>;
};
}
export interface section {
id: number;
text: string;
toclevel: number;
line: string;
anchor: string;
}
export interface htmlText {
html: string;
text: string;
}
{
"name": "wikipedia",
"version": "1.0.5",
"version": "1.0.6",
"description": "A JavaScript wrapper for the wikipedia apis",

@@ -5,0 +5,0 @@ "main": "dist",

@@ -150,2 +150,9 @@ # WIKIPEDIA [![build](https://github.com/dopecodez/Wikipedia/workflows/build/badge.svg)](https://github.com/dopecodez/Wikipedia/actions) [![Test Coverage](https://api.codeclimate.com/v1/badges/a44c826dbef8c7f5ea45/test_coverage)](https://codeclimate.com/github/dopecodez/Wikipedia/test_coverage) [![Contributions](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/dopecodez/Wikipedia/issues) [![npm version](https://badge.fury.io/js/wikipedia.svg)](https://badge.fury.io/js/wikipedia)

<td align="center">
<a href="https://github.com/friendofdog">
<img src="https://avatars.githubusercontent.com/u/8337121?v=4" width="100;" alt="friendofdog"/>
<br />
<sub><b>Kevin Kee</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/bumbummen99">

@@ -152,0 +159,0 @@ <img src="https://avatars.githubusercontent.com/u/4533331?v=4" width="100;" alt="bumbummen99"/>

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