New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mediawiki-title

Package Overview
Dependencies
Maintainers
6
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mediawiki-title - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

24

lib/index.js

@@ -84,2 +84,15 @@ 'use strict';

getId() {
return this._id;
}
/**
* Compares two namespaces for equality.
* @param {Namespace} ns
* @return {boolean}
*/
equals(ns) {
return this === ns || this._id === ns._id;
}
isATalkNamespace() {

@@ -374,2 +387,12 @@ // See https://www.mediawiki.org/wiki/Manual:Namespace#Subject_and_talk_namespaces

/**
* Compares two titles for equality.
* @param {Title} title
* @return {boolean}
*/
equals(title) {
return this === title ||
(this._key === title._key && this._namespace.equals(title._namespace));
}
/**
* Normalize a title according to the rules of <domain>

@@ -463,1 +486,2 @@ * @param {string} title The page title to normalize.

module.exports.Title = Title;
module.exports.TitleError = utils.TitleError;

14

package.json
{
"name": "mediawiki-title",
"version": "0.7.1",
"version": "0.7.2",
"description": "Title normalization library for mediawiki",

@@ -28,11 +28,11 @@ "main": "lib/index.js",

"devDependencies": {
"coveralls": "^3.0.2",
"eslint-config-wikimedia": "^0.10.1",
"eslint-plugin-jsdoc": "^4.1.0",
"coveralls": "^3.0.5",
"eslint-config-wikimedia": "^0.13.1",
"eslint-plugin-jsdoc": "^15.5.3",
"eslint-plugin-json": "^1.4.0",
"mocha": "^5.2.0",
"mocha": "^6.1.4",
"mocha-lcov-reporter": "^1.3.0",
"nyc": "^13.3.0",
"preq": "^0.5.7"
"nyc": "^14.1.1",
"preq": "^0.5.9"
}
}

@@ -14,2 +14,4 @@ # mediawiki-title [![npm version](https://badge.fury.io/js/mediawiki-title.svg)](https://badge.fury.io/js/mediawiki-title) [![Build Status](https://travis-ci.org/wikimedia/mediawiki-title.svg?branch=master)](https://travis-ci.org/wikimedia/mediawiki-title) [![Coverage Status](https://coveralls.io/repos/github/wikimedia/mediawiki-title/badge.svg?branch=master)](https://coveralls.io/github/wikimedia/mediawiki-title?branch=master) [![Dependencies](https://david-dm.org/wikimedia/mediawiki-title.svg?branch=master)](https://david-dm.org/wikimedia/mediawiki-title?branch=master)

<dd></dd>
<dt><a href="#TitleError">TitleError</a></dt>
<dd></dd>
</dl>

@@ -37,2 +39,3 @@

* _instance_
* [.getId()](#Namespace++getId) ⇒ <code>number</code>
* [.isMedia()](#Namespace++isMedia) ⇒ <code>boolean</code>

@@ -44,2 +47,3 @@ * [.isSpecial()](#Namespace++isSpecial) ⇒ <code>boolean</code>

* [.getNormalizedText()](#Namespace+getNormalizedText) ⇒ <code>string</code>
* [.equals(ns)](#Namespace+equals) ⇒ <code>boolean</code>
* _static_

@@ -60,2 +64,8 @@ * [.fromText(text, siteInfo)](#Namespace.fromText) ⇒ <code>[Namespace](#Namespace)</code> &#124; <code>undefined</code>

<a name="Namespace++getId"></a>
### namespace.getId() ⇒ <code>number</code>
Returns the numeric namespace identifier
**Kind**: instance method of <code>[Namespace](#Namespace)</code>
<a name="Namespace++isMedia"></a>

@@ -97,2 +107,9 @@

**Kind**: instance method of <code>[Namespace](#Namespace)</code>
<a name="Namespace+equals"></a>
### namespace.equals(ns) ⇒ <code>boolean</code>
Determines whether this namespace is equal to the given <code>ns</code>,
based on the numeric namespace identifier.
**Kind**: instance method of <code>[Namespace](#Namespace)</code>
<a name="Namespace.fromText"></a>

@@ -133,2 +150,3 @@

* [.getNamespace()](#Title+getNamespace) ⇒ <code>[Namespace](#Namespace)</code>
* [.equals(title)](#Title+equals) ⇒ <code>boolean</code>
* _static_

@@ -168,2 +186,9 @@ * [.newFromText(title, siteInfo, defaultNs)](#Title.newFromText) ⇒ <code>[Title](#Title)</code>

**Kind**: instance method of <code>[Title](#Title)</code>
<a name="Title+equals"></a>
### title.equals(title2) ⇒ <code>boolean</code>
Determines whether this title is equals to the given <code>title2</code>,
based on comparing namespace and key.
**Kind**: instance method of <code>[Title](#Title)</code>
<a name="Title.newFromText"></a>

@@ -182,2 +207,13 @@

<a name="TitleError"></a>
## TitleError
**Kind**: global exception class
* [TitleError](#TitleError)
<code>TitleError</code> should be considered an opaque exception class,
which is thrown by the various methods in this library. It is exported
so that it can be identified if caught by the caller.
<a name="SiteInfo"></a>

@@ -184,0 +220,0 @@

@@ -134,2 +134,21 @@ 'use strict';

});
it(`${name} should be equal to itself`, () => {
return getSiteInfo('en.wikipedia.org')
.then((siteInfo) => {
const t1 = Title.newFromText(title[0], siteInfo);
const t2 = Title.newFromText(` ${title[0]}_`, siteInfo);
assert.deepEqual(t1.equals(t2), true);
assert.deepEqual(t2.equals(t1), true);
});
});
it(`${name} should not be equal to other titles`, () => {
return getSiteInfo('en.wikipedia.org')
.then((siteInfo) => {
const t1 = Title.newFromText(title[0], siteInfo);
const t2 = Title.newFromText('NOT EQUAL TO ANYTHING', siteInfo);
assert.deepEqual(t1.equals(t2), false);
assert.deepEqual(t2.equals(t1), false);
});
});
});

@@ -295,3 +314,3 @@ });

const t = Title.newFromText(test[1], siteInfo, test[0]);
return [t.getNamespace()._id, t.getPrefixedDBKey()];
return [t.getNamespace().getId(), t.getPrefixedDBKey()];
})

@@ -298,0 +317,0 @@ .then((res) => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc