diff --git a/dev/Common/Globals.js b/dev/Common/Globals.js index b46eb431b..4f4ff384e 100644 --- a/dev/Common/Globals.js +++ b/dev/Common/Globals.js @@ -49,17 +49,17 @@ export const sUserAgent = /** * @type {boolean} */ -export const bIE = -1 < sUserAgent.indexOf('msie'); +export const bIE = sUserAgent.includes('msie'); /** * @type {boolean} */ -export const bChrome = -1 < sUserAgent.indexOf('chrome'); +export const bChrome = sUserAgent.includes('chrome'); /** * @type {boolean} */ -export const bSafari = !bChrome && -1 < sUserAgent.indexOf('safari'); +export const bSafari = !bChrome && sUserAgent.includes('safari'); /** * @type {boolean} diff --git a/dev/External/ko.js b/dev/External/ko.js index 8f365c7a8..c5612a33d 100644 --- a/dev/External/ko.js +++ b/dev/External/ko.js @@ -818,7 +818,7 @@ ko.bindingHandlers.emailsTags = { autoCompleteSource: fAutoCompleteSource, splitHook: (value) => { const v = Utils.trim(value); - if (v && -1 < inputDelimiters.indexOf(v.substr(-1))) { + if (v && inputDelimiters.includes(v.substr(-1))) { return EmailModel.splitEmailLine(value); } return null; diff --git a/dev/Model/Email.js b/dev/Model/Email.js index 274bebc41..2bfa212d9 100644 --- a/dev/Model/Email.js +++ b/dev/Model/Email.js @@ -73,7 +73,7 @@ class EmailModel { * @returns {boolean} */ search(query) { - return -1 < (this.name + ' ' + this.email).toLowerCase().indexOf(query.toLowerCase()); + return (this.name + ' ' + this.email).toLowerCase().includes(query.toLowerCase()); } /** diff --git a/dev/Promises/User/Populator.js b/dev/Promises/User/Populator.js index 8602ab670..34c09b1de 100644 --- a/dev/Promises/User/Populator.js +++ b/dev/Promises/User/Populator.js @@ -23,7 +23,7 @@ class PromisesUserPopulator extends AbstractBasicPromises { * @returns {boolean} */ isFolderExpanded(sFullNameHash, expandedFolders) { - return expandedFolders && isArray(expandedFolders) && -1 !== _.indexOf(expandedFolders, sFullNameHash); + return expandedFolders && isArray(expandedFolders) && expandedFolders.includes(sFullNameHash); } /** diff --git a/dev/Remote/User/Ajax.js b/dev/Remote/User/Ajax.js index 59ffdea93..8fc5cfe08 100644 --- a/dev/Remote/User/Ajax.js +++ b/dev/Remote/User/Ajax.js @@ -315,7 +315,7 @@ class RemoteUserAjax extends AbstractAjaxRemote { useThreads = AppStore.threadsAllowed() && SettingsStore.useThreads(), inboxUidNext = getFolderInboxName() === sFolderFullNameRaw ? getFolderUidNext(sFolderFullNameRaw) : ''; - if ('' !== folderHash && ('' === sSearch || -1 === sSearch.indexOf('is:'))) { + if ('' !== folderHash && ('' === sSearch || !sSearch.includes('is:'))) { return this.defaultRequest( fCallback, 'MessageList', diff --git a/dev/Stores/User/Pgp.js b/dev/Stores/User/Pgp.js index 34d8951de..befa7b877 100644 --- a/dev/Stores/User/Pgp.js +++ b/dev/Stores/User/Pgp.js @@ -30,7 +30,7 @@ class PgpUserStore { } findKeyByHex(keys, hash) { - return _.find(keys, (item) => hash && item && (hash === item.id || -1 < item.ids.indexOf(hash))); + return _.find(keys, (item) => hash && item && (hash === item.id || item.ids.includes(hash))); } findPublicKeyByHex(hash) { @@ -45,7 +45,7 @@ class PgpUserStore { return _.compact( _.flatten( _.map(this.openpgpkeysPublic(), (item) => { - const key = item && -1 < item.emails.indexOf(email) ? item : null; + const key = item && item.emails.includes(email) ? item : null; return key ? key.getNativeKeys() : [null]; }), true @@ -108,7 +108,7 @@ class PgpUserStore { * @returns {?} */ findPublicKeyByEmailNotNative(email) { - return _.find(this.openpgpkeysPublic(), (item) => item && -1 < item.emails.indexOf(email)) || null; + return _.find(this.openpgpkeysPublic(), (item) => item && item.emails.includes(email)) || null; } /** @@ -116,7 +116,7 @@ class PgpUserStore { * @returns {?} */ findPrivateKeyByEmailNotNative(email) { - return _.find(this.openpgpkeysPrivate(), (item) => item && -1 < item.emails.indexOf(email)) || null; + return _.find(this.openpgpkeysPrivate(), (item) => item && item.emails.includes(email)) || null; } /** @@ -124,7 +124,7 @@ class PgpUserStore { * @returns {?} */ findAllPublicKeysByEmailNotNative(email) { - return this.openpgpkeysPublic().filter(item => item && -1 < item.emails.indexOf(email)) || null; + return this.openpgpkeysPublic().filter(item => item && item.emails.includes(email)) || null; } /** @@ -132,7 +132,7 @@ class PgpUserStore { * @returns {?} */ findAllPrivateKeysByEmailNotNative(email) { - return this.openpgpkeysPrivate().filter(item => item && -1 < item.emails.indexOf(email)) || null; + return this.openpgpkeysPrivate().filter(item => item && item.emails.includes(email)) || null; } /** @@ -142,7 +142,7 @@ class PgpUserStore { */ findPrivateKeyByEmail(email, password) { let privateKey = null; - const key = _.find(this.openpgpkeysPrivate(), (item) => item && -1 < item.emails.indexOf(email)); + const key = _.find(this.openpgpkeysPrivate(), (item) => item && item.emails.includes(email)); if (key) { try { diff --git a/dev/View/Popup/AdvancedSearch.js b/dev/View/Popup/AdvancedSearch.js index 08aed0eba..952bd7220 100644 --- a/dev/View/Popup/AdvancedSearch.js +++ b/dev/View/Popup/AdvancedSearch.js @@ -73,7 +73,7 @@ class AdvancedSearchPopupView extends AbstractViewNext { } buildSearchStringValue(value) { - if (-1 < value.indexOf(' ')) { + if (value.includes(' ')) { value = '"' + value + '"'; } return value; diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 4724e88f4..f00103867 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -739,7 +739,7 @@ class ComposePopupView extends AbstractViewNext { if ('' !== fromLine) { signature = signature.replace(/{{FROM-FULL}}/g, fromLine); - if (-1 === fromLine.indexOf(' ') && 0 < fromLine.indexOf('@')) { + if (!fromLine.includes(' ') && 0 < fromLine.indexOf('@')) { fromLine = fromLine.replace(/@[\S]+/, ''); } @@ -752,14 +752,14 @@ class ComposePopupView extends AbstractViewNext { signature = signature.replace(/{{FROM}}/g, ''); signature = signature.replace(/{{FROM-FULL}}/g, ''); - if (-1 < signature.indexOf('{{DATE}}')) { + if (signature.includes('{{DATE}}')) { signature = signature.replace(/{{DATE}}/g, momentorFormat(0, 'llll')); } - if (-1 < signature.indexOf('{{TIME}}')) { + if (signature.includes('{{TIME}}')) { signature = signature.replace(/{{TIME}}/g, momentorFormat(0, 'LT')); } - if (-1 < signature.indexOf('{{MOMENT:')) { + if (signature.includes('{{MOMENT:')) { try { let match = null; while (null !== (match = momentRegx.exec(signature))) {