var result;
// Check if we're already dealing with an array of colors
- if ( color && $.isArray( color ) && color.length === 3 ) {
+ if ( color && Array.isArray( color ) && color.length === 3 ) {
return color;
}
return false;
}
for ( i = 0; i < arrThis.length; i++ ) {
- if ( $.isArray( arrThis[ i ] ) ) {
+ if ( Array.isArray( arrThis[ i ] ) ) {
if ( !$.compareArray( arrThis[ i ], arrAgainst[ i ] ) ) {
return false;
}
break;
default:
- if ( !$.isArray( pi.type ) ) {
+ if ( !Array.isArray( pi.type ) ) {
throw new Error( 'Unknown parameter type ' + pi.type );
}
break;
default:
- if ( $.isArray( pi.parameters[ i ].type ) ) {
+ if ( Array.isArray( pi.parameters[ i ].type ) ) {
flag = false;
count = pi.parameters[ i ].type.length;
}
* button object in a list of variadic arguments.
*/
addButtons: function ( buttons ) {
- if ( !$.isArray( buttons ) ) {
+ if ( !Array.isArray( buttons ) ) {
buttons = slice.call( arguments );
}
if ( isReady ) {
for ( i = 0; i < queue.length; i++ ) {
button = queue[ i ];
- if ( $.isArray( button ) ) {
+ if ( Array.isArray( button ) ) {
// Forwarded arguments array from mw.toolbar.addButton
insertButton.apply( toolbar, button );
} else {
var categories = [];
$.each( res.query.pages, function ( index, page ) {
- if ( !page.missing && $.isArray( page.categories ) ) {
+ if ( !page.missing && Array.isArray( page.categories ) ) {
categories.push.apply( categories, page.categories.map( function ( category ) {
return category.title;
} ) );
// Handle common MediaWiki API idioms for passing parameters
for ( key in parameters ) {
// Multiple values are pipe-separated
- if ( $.isArray( parameters[ key ] ) ) {
+ if ( Array.isArray( parameters[ key ] ) ) {
if ( !useUS || parameters[ key ].join( '' ).indexOf( '|' ) === -1 ) {
parameters[ key ] = parameters[ key ].join( '|' );
} else {
{
formatversion: 2,
action: 'watch',
- titles: $.isArray( pages ) ? pages.join( '|' ) : String( pages )
+ titles: Array.isArray( pages ) ? pages.join( '|' ) : String( pages )
},
addParams
)
return apiPromise
.then( function ( data ) {
// If a single page was given (not an array) respond with a single item as well.
- return $.isArray( pages ) ? data.watch : data.watch[ 0 ];
+ return Array.isArray( pages ) ? data.watch : data.watch[ 0 ];
} )
.promise( { abort: apiPromise.abort } );
}
funcs = [];
fields = [];
for ( i = 1; i < l; i++ ) {
- if ( !$.isArray( spec[ i ] ) ) {
+ if ( !Array.isArray( spec[ i ] ) ) {
throw new Error( op + ' parameters must be arrays' );
}
v = hideIfParse( $el, spec[ i ] );
if ( l !== 2 ) {
throw new Error( 'NOT takes exactly one parameter' );
}
- if ( !$.isArray( spec[ 1 ] ) ) {
+ if ( !Array.isArray( spec[ 1 ] ) ) {
throw new Error( 'NOT parameters must be arrays' );
}
v = hideIfParse( $el, spec[ 1 ] );
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++ ) {
// Only copy direct properties, not inherited ones
if ( uri.hasOwnProperty( prop ) ) {
// Deep copy object properties
- if ( $.isArray( uri[ prop ] ) || $.isPlainObject( uri[ prop ] ) ) {
+ if ( Array.isArray( uri[ prop ] ) || $.isPlainObject( uri[ prop ] ) ) {
this[ prop ] = $.extend( true, {}, uri[ prop ] );
} else {
this[ prop ] = uri[ prop ];
q[ k ] = [ q[ k ] ];
}
// Add to the array
- if ( $.isArray( q[ k ] ) ) {
+ if ( Array.isArray( q[ k ] ) ) {
q[ k ].push( v );
}
}
var args = [];
$.each( this.query, function ( key, val ) {
var k = Uri.encode( key ),
- vals = $.isArray( val ) ? val : [ val ];
+ vals = Array.isArray( val ) ? val : [ val ];
$.each( vals, function ( i, v ) {
if ( v === null ) {
args.push( k );
// Grep module's CSS
if (
- $.isPlainObject( module.style ) && $.isArray( module.style.css ) &&
+ $.isPlainObject( module.style ) && Array.isArray( module.style.css ) &&
pattern.test( module.style.css.join( '' ) )
) {
// Module's CSS source matches
function appendWithoutParsing( $parent, children ) {
var i, len;
- if ( !$.isArray( children ) ) {
+ if ( !Array.isArray( children ) ) {
children = [ children ];
}
// eslint-disable-next-line new-cap
parser = new mw.jqueryMsg.parser( options ),
key = args[ 0 ],
- argsArray = $.isArray( args[ 1 ] ) ? args[ 1 ] : slice.call( args, 1 );
+ argsArray = Array.isArray( args[ 1 ] ) ? args[ 1 ] : slice.call( args, 1 );
try {
return parser.parse( key, argsArray );
} catch ( e ) {
var results, i;
fallback = arguments.length > 1 ? fallback : null;
- if ( $.isArray( selection ) ) {
+ if ( Array.isArray( selection ) ) {
results = {};
for ( i = 0; i < selection.length; i++ ) {
if ( typeof selection[ i ] === 'string' ) {
*/
exists: function ( selection ) {
var i;
- if ( $.isArray( selection ) ) {
+ if ( Array.isArray( selection ) ) {
for ( i = 0; i < selection.length; i++ ) {
if ( typeof selection[ i ] !== 'string' || !hasOwn.call( this.values, selection[ i ] ) ) {
return false;
legacyWait.always( function () {
try {
- if ( $.isArray( script ) ) {
+ if ( Array.isArray( script ) ) {
nestedAddScript( script, markModuleReady, 0 );
} else if ( typeof script === 'function' ) {
// Pass jQuery twice so that the signature of the closure which wraps
// Array of css strings in key 'css',
// or back-compat array of urls from media-type
- if ( $.isArray( value ) ) {
+ if ( Array.isArray( value ) ) {
for ( i = 0; i < value.length; i++ ) {
if ( key === 'bc-url' ) {
// back-compat: { <media>: [url, ..] }
}
function among( actual, expected, message ) {
- if ( $.isArray( expected ) ) {
+ if ( Array.isArray( expected ) ) {
assert.ok( $.inArray( actual, expected ) !== -1, message + ' (got ' + actual + '; expected one of ' + expected.join( ', ' ) + ')' );
} else {
assert.equal( actual, expected, message );
assert.ok( true, 'QUnit expected() count dummy' );
},
function ( e, dependencies ) {
- assert.strictEqual( $.isArray( dependencies ), true, 'Expected array of dependencies' );
+ assert.strictEqual( Array.isArray( dependencies ), true, 'Expected array of dependencies' );
assert.deepEqual( dependencies, [ 'test.module7' ], 'Error callback called with module test.module7' );
}
);
assert.ok( true, 'QUnit expected() count dummy' );
},
function ( e, dependencies ) {
- assert.strictEqual( $.isArray( dependencies ), true, 'Expected array of dependencies' );
+ assert.strictEqual( Array.isArray( dependencies ), true, 'Expected array of dependencies' );
dependencies.sort();
assert.deepEqual(
dependencies,