Skip to content

Commit b0bc1aa

Browse files
authored
Merge pull request #76 from dopecodez/fix-categories-limit
Change pllimit to cllimit for categories query in wikimedia
2 parents 6e1663f + 9e91baa commit b0bc1aa

4 files changed

Lines changed: 25 additions & 24 deletions

File tree

CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Contributing
22

33
We welcome patches and features. There are however a few things that are
4-
required before your pull request can be merged. Make sure you cut a branch
5-
from develop and all PRs pointed towards master.
4+
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.
65

76
# Tests
87

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

1312
## Running test cases
1413

15-
Make sure your PR passes all the tests by running `npm run test` before
14+
Make sure your PR passes all the tests by running `yarn test` before
1615
raising a PR.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Govind S
3+
Copyright (c) 2025 Govind S
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,27 @@ For detailed documentation of methods available on `wiki` and `page`,
4545

4646
## Usage
4747

48+
You can use wikipedia using ES6 directly
49+
50+
```js
51+
import wiki from 'wikipedia';
52+
import { wikiSummary, summaryError } from 'wikipedia';
53+
import { summary } from 'wikipedia';
54+
55+
(async () => {
56+
try {
57+
let summary: wikiSummary; //sets the object as type wikiSummary
58+
summary = await wiki.summary('Batman');
59+
console.log(summary);
60+
let summary2 = await summary('Batman');//using summary directly
61+
} catch (error) {
62+
console.log(error);
63+
//=> Typeof summaryError, helpful in case you want to handle this error separately
64+
}
65+
})();
66+
```
67+
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.
68+
4869
```js
4970
const wiki = require('wikipedia');
5071

@@ -128,25 +149,6 @@ const wiki = require('wikipedia');
128149
})();
129150
```
130151

131-
You can export types or even specific methods if you are using modern ES6 js or TypeScript.
132-
```js
133-
import wiki from 'wikipedia';
134-
import { wikiSummary, summaryError } from 'wikipedia';
135-
import { summary } from 'wikipedia';
136-
137-
(async () => {
138-
try {
139-
let summary: wikiSummary; //sets the object as type wikiSummary
140-
summary = await wiki.summary('Batman');
141-
console.log(summary);
142-
let summary2 = await summary('Batman');//using summary directly
143-
} catch (error) {
144-
console.log(error);
145-
//=> Typeof summaryError, helpful in case you want to handle this error separately
146-
}
147-
})();
148-
```
149-
150152
## Options
151153

152154
All methods have options you can pass them. You can find them in [optionTypes documentation][5].

source/page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ export const categories = async (title: string, listOptions?: listOptions): Prom
554554
try {
555555
let categoryOptions: any = {
556556
prop: 'categories',
557-
pllimit: listOptions?.limit,
557+
cllimit: listOptions?.limit,
558558
}
559559
categoryOptions = setPageIdOrTitleParam(categoryOptions, title);
560560
const response = await request(categoryOptions, listOptions?.redirect);

0 commit comments

Comments
 (0)