},
// brackets, greater than
{
- pattern: /[\]\}>]/g,
+ pattern: /[}\]>]/g,
replace: ')',
generalRule: true
},
// brackets, lower than
{
- pattern: /[\[\{<]/g,
+ pattern: /[{[<]/g,
replace: '(',
generalRule: true
},
}
// Any remaining initial :s are illegal.
- title = title.replace( /^\:+/, '' );
+ title = title.replace( /^:+/, '' );
return Title.newFromText( title, namespace );
};
thumbPhpRegex = /thumb\.php/,
regexes = [
// Thumbnails
- /\/[a-f0-9]\/[a-f0-9]{2}\/([^\s\/]+)\/[^\s\/]+-[^\s\/]*$/,
+ /\/[a-f0-9]\/[a-f0-9]{2}\/([^\s/]+)\/[^\s/]+-[^\s/]*$/,
// Full size images
- /\/[a-f0-9]\/[a-f0-9]{2}\/([^\s\/]+)$/,
+ /\/[a-f0-9]\/[a-f0-9]{2}\/([^\s/]+)$/,
// Thumbnails in non-hashed upload directories
- /\/([^\s\/]+)\/[^\s\/]+-(?:\1|thumbnail)[^\s\/]*$/,
+ /\/([^\s/]+)\/[^\s/]+-(?:\1|thumbnail)[^\s/]*$/,
// Full-size images in non-hashed upload directories
- /\/([^\s\/]+)$/
+ /\/([^\s/]+)$/
],
recount = regexes.length;
*/
Title.exists = function ( title ) {
var match,
- type = $.type( title ),
obj = Title.exist.pages;
- if ( type === 'string' ) {
+ if ( typeof title === 'string' ) {
match = obj[ title ];
- } else if ( type === 'object' && title instanceof Title ) {
+ } else if ( title instanceof Title ) {
match = obj[ title.toString() ];
} else {
throw new Error( 'mw.Title.exists: title must be a string or an instance of Title' );
}
- if ( typeof match === 'boolean' ) {
- return match;
+ if ( typeof match !== 'boolean' ) {
+ return null;
}
- return null;
+ return match;
};
/**
var i, len,
pages = this.pages;
- titles = $.isArray( titles ) ? titles : [ titles ];
+ titles = Array.isArray( titles ) ? titles : [ titles ];
state = state === undefined ? true : !!state;
for ( i = 0, len = titles.length; i < len; i++ ) {