Skip to content
This repository was archived by the owner on Mar 29, 2021. It is now read-only.

Commit 4f5df5e

Browse files
committed
extracting contions for title into function
1 parent e7fb594 commit 4f5df5e

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

src/mods/tier.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,20 @@ idrinth.tier = {
197197
* @returns {object} for the buildElement wrapper
198198
*/
199199
var addTitle = function ( ln, listKey, difficulty, ic ) {
200-
if (
201-
!idrinth.tier.list[listKey].hasOwnProperty ( 'loot' ) ||
202-
!idrinth.tier.list[listKey].loot.hasOwnProperty ( difficulty ) ||
203-
!idrinth.tier.list[listKey].loot[difficulty].hasOwnProperty ( ic ) ||
204-
!idrinth.tier.list[listKey].loot[difficulty][ic]
205-
) {
200+
/**
201+
*
202+
* @param {string} listKey
203+
* @param {string} difficulty
204+
* @param {string} ic
205+
* @returns {Boolean}
206+
*/
207+
var isUseable = function ( listKey, difficulty, ic ) {
208+
return idrinth.tier.list[listKey].hasOwnProperty ( 'loot' ) &&
209+
idrinth.tier.list[listKey].loot.hasOwnProperty ( difficulty ) &&
210+
idrinth.tier.list[listKey].loot[difficulty].hasOwnProperty ( ic ) &&
211+
idrinth.tier.list[listKey].loot[difficulty][ic];
212+
};
213+
if ( !isUseable ( listKey, difficulty, ic ) ) {
206214
return ln;
207215
}
208216
var title = "";

0 commit comments

Comments
 (0)