Merge "Remove hasOwnProperty checks in for-loops"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 6 Jul 2018 18:13:49 +0000 (18:13 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 6 Jul 2018 18:13:49 +0000 (18:13 +0000)
resources/src/jquery.tablesorter/jquery.tablesorter.js
resources/src/mediawiki.api/upload.js
resources/src/mediawiki.debug/debug.js
resources/src/mediawiki.language/mediawiki.language.numbers.js
resources/src/mediawiki.page.watch.ajax.js

index 9417669..64d394c 100644 (file)
                if ( ts.collationTable ) {
                        // Build array of key names
                        for ( key in ts.collationTable ) {
-                               // Check hasOwn to be safe
-                               if ( Object.prototype.hasOwnProperty.call( ts.collationTable, key ) ) {
-                                       keys.push( mw.RegExp.escape( key ) );
-                               }
+                               keys.push( mw.RegExp.escape( key ) );
                        }
                        if ( keys.length ) {
                                ts.collationRegex = new RegExp( keys.join( '|' ), 'ig' );
index a6451ac..f343321 100644 (file)
@@ -40,9 +40,7 @@
        function getFirstKey( obj ) {
                var key;
                for ( key in obj ) {
-                       if ( Object.prototype.hasOwnProperty.call( obj, key ) ) {
-                               return key;
-                       }
+                       return key;
                }
        }
 
index dfb6967..37c0fac 100644 (file)
                        };
 
                        for ( id in panes ) {
-                               if ( !Object.prototype.hasOwnProperty.call( panes, id ) ) {
-                                       continue;
-                               }
-
                                $( '<div>' )
                                        .prop( {
                                                className: 'mw-debug-pane',
                                        .appendTo( $table );
 
                                for ( key in data ) {
-                                       if ( !Object.prototype.hasOwnProperty.call( data, key ) ) {
-                                               continue;
-                                       }
-
                                        $( '<tr>' )
                                                .append( $( '<th>' ).text( key ) )
                                                .append( $( '<td>' ).text( data[ key ] ) )
index 4360adc..f4194d3 100644 (file)
                for ( i = 0; i < arguments.length; i++ ) {
                        table = arguments[ i ];
                        for ( key in table ) {
-                               if ( Object.prototype.hasOwnProperty.call( table, key ) ) {
-                                       // The thousand separator should be deleted
-                                       flipped[ table[ key ] ] = key === ',' ? '' : key;
-                               }
+                               // The thousand separator should be deleted
+                               flipped[ table[ key ] ] = key === ',' ? '' : key;
                        }
                }
 
index 097653d..2002b9f 100644 (file)
 
                actionPaths = mw.config.get( 'wgActionPaths' );
                for ( key in actionPaths ) {
-                       if ( Object.prototype.hasOwnProperty.call( actionPaths, key ) ) {
-                               parts = actionPaths[ key ].split( '$1' );
-                               parts = parts.map( mw.RegExp.escape );
-                               m = new RegExp( parts.join( '(.+)' ) ).exec( url );
-                               if ( m && m[ 1 ] ) {
-                                       return key;
-                               }
-
+                       parts = actionPaths[ key ].split( '$1' );
+                       parts = parts.map( mw.RegExp.escape );
+                       m = new RegExp( parts.join( '(.+)' ) ).exec( url );
+                       if ( m && m[ 1 ] ) {
+                               return key;
                        }
                }