mediawiki-projects-list 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -172,7 +172,7 @@ function urlToIdString(url) {
172
172
  let project = getWikiProject(url.hostname);
173
173
  if ( !project ) project = getFrontendProxy(url.hostname);
174
174
  if ( project?.idString ) {
175
- let regex = url.href.match( new RegExp( project.regex ) )?.slice(2);
175
+ let regex = url.href.match( new RegExp( project.regex ) )?.slice(2).filter( part => part );
176
176
  if ( regex?.length ) {
177
177
  if ( project.idString.direction === 'desc' ) regex.reverse();
178
178
  result = regex.join(project.idString.separator);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediawiki-projects-list",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "type": "commonjs",
5
5
  "description": "List of MediaWiki projects for use in discord-wiki-bot",
6
6
  "main": "index.js",