From 9ad3bd0d47f7a4825bcb7d36918a55c94cf7939d Mon Sep 17 00:00:00 2001 From: Govind S Date: Fri, 31 Oct 2025 11:54:15 +0530 Subject: [PATCH 1/2] Change pllimit to cllimit for categories query in wikimedia --- source/page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/page.ts b/source/page.ts index 4845d8a..f38d1e8 100644 --- a/source/page.ts +++ b/source/page.ts @@ -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); From 9e91baae3d447f511de42f5d2853d7bece86e44e Mon Sep 17 00:00:00 2001 From: Govind S Date: Fri, 31 Oct 2025 12:16:44 +0530 Subject: [PATCH 2/2] fix minor readme changes and encourage es6 usage --- CONTRIBUTING.md | 5 ++--- LICENSE | 2 +- README.md | 40 +++++++++++++++++++++------------------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa7dc92..f7df78d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -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. diff --git a/LICENSE b/LICENSE index acf4361..1623c7d 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index 2195467..f3c4f86 100644 --- a/README.md +++ b/README.md @@ -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'); @@ -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].