Merge Objects prototype extensions

This commit is contained in:
djmaze 2020-09-04 17:07:35 +02:00
parent 0647b5201f
commit f2d194947d
26 changed files with 108 additions and 127 deletions

View file

@ -12,7 +12,6 @@ import {
} from 'Common/Enums';
import {
isNonEmptyArray,
replySubjectAdd,
encodeHtml,
inFocus,
@ -263,7 +262,7 @@ class ComposePopupView extends AbstractViewNext {
});
this.attachmentsInProcess.subscribe(value => {
if (this.attachmentsInProcessError() && isNonEmptyArray(value)) {
if (this.attachmentsInProcessError() && Array.isNotEmpty(value)) {
this.attachmentsInProcessError(false);
}
});
@ -772,7 +771,7 @@ class ComposePopupView extends AbstractViewNext {
* @param {Array} emails
*/
addEmailsTo(fKoValue, emails) {
if (isNonEmptyArray(emails)) {
if (Array.isNotEmpty(emails)) {
const value = fKoValue().trim(),
values = emails.map(item => item ? item.toLine(false) : null)
.filter((value, index, self) => !!value && self.indexOf(value) == index);
@ -842,15 +841,15 @@ class ComposePopupView extends AbstractViewNext {
excludeEmail[identity.email()] = true;
}
if (isNonEmptyArray(aToEmails)) {
if (Array.isNotEmpty(aToEmails)) {
this.to(this.emailArrayToStringLineHelper(aToEmails));
}
if (isNonEmptyArray(aCcEmails)) {
if (Array.isNotEmpty(aCcEmails)) {
this.cc(this.emailArrayToStringLineHelper(aCcEmails));
}
if (isNonEmptyArray(aBccEmails)) {
if (Array.isNotEmpty(aBccEmails)) {
this.bcc(this.emailArrayToStringLineHelper(aBccEmails));
}
@ -915,7 +914,7 @@ class ComposePopupView extends AbstractViewNext {
this.subject(sSubject);
this.prepearMessageAttachments(message, lineComposeType);
this.aDraftInfo = isNonEmptyArray(aDraftInfo) && 3 === aDraftInfo.length ? aDraftInfo : null;
this.aDraftInfo = Array.isNotEmpty(aDraftInfo) && 3 === aDraftInfo.length ? aDraftInfo : null;
this.sInReplyTo = message.sInReplyTo;
this.sReferences = message.sReferences;
break;
@ -929,7 +928,7 @@ class ComposePopupView extends AbstractViewNext {
this.subject(sSubject);
this.prepearMessageAttachments(message, lineComposeType);
this.aDraftInfo = isNonEmptyArray(aDraftInfo) && 3 === aDraftInfo.length ? aDraftInfo : null;
this.aDraftInfo = Array.isNotEmpty(aDraftInfo) && 3 === aDraftInfo.length ? aDraftInfo : null;
this.sInReplyTo = message.sInReplyTo;
this.sReferences = message.sReferences;
break;
@ -1021,7 +1020,7 @@ class ComposePopupView extends AbstractViewNext {
this.setFocusInPopup();
});
} else if (isNonEmptyArray(oMessageOrArray)) {
} else if (Array.isNotEmpty(oMessageOrArray)) {
oMessageOrArray.forEach(item => {
this.addMessageAsAttachment(item);
});
@ -1047,7 +1046,7 @@ class ComposePopupView extends AbstractViewNext {
}
const downloads = this.getAttachmentsDownloadsForUpload();
if (isNonEmptyArray(downloads)) {
if (Array.isNotEmpty(downloads)) {
Remote.messageUploadAttachments(()=>this.onMessageUploadAttachments(), downloads);
}
@ -1375,7 +1374,7 @@ class ComposePopupView extends AbstractViewNext {
this.addMessageAsAttachment(message);
} else {
const attachments = message.attachments();
(isNonEmptyArray(attachments) ? attachments : []).forEach(item => {
(Array.isNotEmpty(attachments) ? attachments : []).forEach(item => {
let add = false;
switch (type) {
case ComposeType.Reply:

View file

@ -13,7 +13,6 @@ import {
import {
delegateRunOnDestroy,
computedPagenatorHelper,
isNonEmptyArray,
fakeMd5,
pInt
} from 'Common/Utils';
@ -229,7 +228,7 @@ class ContactsPopupView extends AbstractViewNext {
bccEmails = null;
const aC = this.contactsCheckedOrSelected();
if (isNonEmptyArray(aC)) {
if (Array.isNotEmpty(aC)) {
aE = aC.map(oItem => {
if (oItem) {
const data = oItem.getNameAndEmailHelper(),
@ -246,7 +245,7 @@ class ContactsPopupView extends AbstractViewNext {
aE = aE.filter(value => !!value);
}
if (isNonEmptyArray(aE)) {
if (Array.isNotEmpty(aE)) {
this.bBackToCompose = false;
hideScreenPopup(ContactsPopupView);
@ -511,7 +510,7 @@ class ContactsPopupView extends AbstractViewNext {
if (contact) {
id = contact.idContact;
if (isNonEmptyArray(contact.properties)) {
if (Array.isNotEmpty(contact.properties)) {
contact.properties.forEach(property => {
if (property && property[0]) {
if (ContactPropertyType.LastName === property[0]) {
@ -579,7 +578,7 @@ class ContactsPopupView extends AbstractViewNext {
list = [];
if (StorageResultType.Success === result && data && data.Result && data.Result.List) {
if (isNonEmptyArray(data.Result.List)) {
if (Array.isNotEmpty(data.Result.List)) {
list = data.Result.List.map(item => {
const contact = new ContactModel();
return contact.parse(item) ? contact : null;

View file

@ -83,7 +83,7 @@ class PluginPopupView extends AbstractViewNext {
this.readme(oPlugin.Readme);
const config = oPlugin.Config;
if (Array.isArray(config) && config.length) {
if (Array.isNotEmpty(config)) {
this.configures(
config.map(item => ({
'value': ko.observable(item[0]),

View file

@ -16,7 +16,6 @@ import {
import { $htmlCL, leftPanelDisabled, keyScopeReal, useKeyboardShortcuts, moveAction } from 'Common/Globals';
import {
isNonEmptyArray,
inFocus,
removeSelection,
removeInFocus,
@ -213,7 +212,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
this.viewFromDkimStatusTitle = ko.computed(() => {
const status = this.viewFromDkimData();
if (isNonEmptyArray(status)) {
if (Array.isNotEmpty(status)) {
if (status[0] && status[1]) {
return status[1];
} else if (status[0]) {