} );
}
- $.each( dependencies, function ( idx, module ) {
+ dependencies.forEach( function ( module ) {
var state = mw.loader.getState( module );
// Only queue modules that are still in the initial 'registered' state
// (not ones already loading, ready or error).
function splitModuleKey( key ) {
var index = key.indexOf( '@' );
if ( index === -1 ) {
- return { name: key };
+ return {
+ name: key,
+ version: ''
+ };
}
return {
name: key.slice( 0, index ),
* in the registry.
*/
getVersion: function ( module ) {
- if ( !hasOwn.call( registry, module ) || registry[ module ].version === undefined ) {
- return null;
- }
- return registry[ module ].version;
+ return hasOwn.call( registry, module ) ? registry[ module ].version : null;
},
/**
* in the registry.
*/
getState: function ( module ) {
- if ( !hasOwn.call( registry, module ) || registry[ module ].state === undefined ) {
- return null;
- }
- return registry[ module ].state;
+ return hasOwn.call( registry, module ) ? registry[ module ].state : null;
},
/**