Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232481

Change subject: Simplify hasOwnProperty checks in wikibase.getLanguageNameByCode
......................................................................

Simplify hasOwnProperty checks in wikibase.getLanguageNameByCode

This removes one check that's not necesarry. It also removes the shortcut.

Change-Id: I1f7a74a369ea3753f2e4538e068376e416b82166
---
M view/resources/wikibase/wikibase.getLanguageNameByCode.js
1 file changed, 3 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/81/232481/1

diff --git a/view/resources/wikibase/wikibase.getLanguageNameByCode.js 
b/view/resources/wikibase/wikibase.getLanguageNameByCode.js
index ee3ba65..58fbdad 100644
--- a/view/resources/wikibase/wikibase.getLanguageNameByCode.js
+++ b/view/resources/wikibase/wikibase.getLanguageNameByCode.js
@@ -8,8 +8,6 @@
 ( function ( wb, mw, $ ) {
        'use strict';
 
-       var hasOwn = Object.prototype.hasOwnProperty;
-
        /**
         * Tries to retrieve Universal Language Selector's set of languages.
         *
@@ -33,7 +31,8 @@
         */
        var getNativeLanguageName = function( langCode ) {
                var languages = getLanguages();
-               return hasOwn.call( languages, langCode ) && 
languages[langCode][2] || langCode;
+               return Object.prototype.hasOwnProperty.call( languages, 
langCode ) && languages[langCode][2]
+                       || langCode;
        };
 
        /**
@@ -45,7 +44,7 @@
         */
        wb.getLanguageNameByCode = function( langCode ) {
                var ulsLanguages = mw.config.get( 'wgULSLanguages' );
-               return ulsLanguages && hasOwn.call( ulsLanguages, langCode ) && 
ulsLanguages[langCode]
+               return ulsLanguages && Object.prototype.hasOwnProperty.call( 
ulsLanguages, langCode )
                        || getNativeLanguageName( langCode );
        };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/232481
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f7a74a369ea3753f2e4538e068376e416b82166
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to