* @class mw.Uri
*/
+/* eslint-disable no-use-before-define */
+
( function ( mw, $ ) {
+ var parser, properties;
+
/**
* Function that's useful when constructing the URI string -- we frequently encounter the pattern
* of having to add something to the URI as we go, but only if it's present, and to include a
if ( val === undefined || val === null || val === '' ) {
return '';
}
- /* jshint latedef:false */
+
return pre + ( raw ? val : mw.Uri.encode( val ) ) + post;
- /* jshint latedef:true */
}
/**
* @static
* @property {Object} parser
*/
- var parser = {
+ parser = {
strict: mw.template.get( 'mediawiki.Uri', 'strict.regexp' ).render(),
loose: mw.template.get( 'mediawiki.Uri', 'loose.regexp' ).render()
- },
+ };
/**
* The order here matches the order of captured matches in the `parser` property regexes.
* @param {boolean} [options.overrideKeys=false] Whether to let duplicate query parameters
* override each other (`true`) or automagically convert them to an array (`false`).
*/
- /* jshint latedef:false */
function Uri( uri, options ) {
var prop,
defaultUri = getDefaultUri();