Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Contributing

We welcome patches and features. There are however a few things that are
required before your pull request can be merged. Make sure you cut a branch
from develop and all PRs pointed towards master.
required before your pull request can be merged. Point your forked repo to master and raise an MR. We currently have 100% test coverage, so please try to write some test cases to cover any new code introduced.

# Tests

Expand All @@ -12,5 +11,5 @@ For any new feature added, we expect a new test case. Since the repo has a 100%

## Running test cases

Make sure your PR passes all the tests by running `npm run test` before
Make sure your PR passes all the tests by running `yarn test` before
raising a PR.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Govind S
Copyright (c) 2025 Govind S

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ For detailed documentation of methods available on `wiki` and `page`,

## Usage

You can use wikipedia using ES6 directly

```js
import wiki from 'wikipedia';
import { wikiSummary, summaryError } from 'wikipedia';
import { summary } from 'wikipedia';

(async () => {
try {
let summary: wikiSummary; //sets the object as type wikiSummary
summary = await wiki.summary('Batman');
console.log(summary);
let summary2 = await summary('Batman');//using summary directly
} catch (error) {
console.log(error);
//=> Typeof summaryError, helpful in case you want to handle this error separately
}
})();
```
You can also use common-js still, but it is encouraged to use ES6 as supporting cjs is proving to be a headache with newer node versions.

```js
const wiki = require('wikipedia');

Expand Down Expand Up @@ -128,25 +149,6 @@ const wiki = require('wikipedia');
})();
```

You can export types or even specific methods if you are using modern ES6 js or TypeScript.
```js
import wiki from 'wikipedia';
import { wikiSummary, summaryError } from 'wikipedia';
import { summary } from 'wikipedia';

(async () => {
try {
let summary: wikiSummary; //sets the object as type wikiSummary
summary = await wiki.summary('Batman');
console.log(summary);
let summary2 = await summary('Batman');//using summary directly
} catch (error) {
console.log(error);
//=> Typeof summaryError, helpful in case you want to handle this error separately
}
})();
```

## Options

All methods have options you can pass them. You can find them in [optionTypes documentation][5].
Expand Down
2 changes: 1 addition & 1 deletion source/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ export const categories = async (title: string, listOptions?: listOptions): Prom
try {
let categoryOptions: any = {
prop: 'categories',
pllimit: listOptions?.limit,
cllimit: listOptions?.limit,
}
categoryOptions = setPageIdOrTitleParam(categoryOptions, title);
const response = await request(categoryOptions, listOptions?.redirect);
Expand Down