mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 13:39:22 +03:00
Underscore.js _.find() to native Array.find()
This commit is contained in:
parent
2404f6466d
commit
9c0072d626
19 changed files with 55 additions and 79 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import _ from '_';
|
||||
import { MessageSetAction } from 'Common/Enums';
|
||||
import { trim, pInt, isArray } from 'Common/Utils';
|
||||
|
||||
|
|
@ -223,7 +222,7 @@ export function initMessageFlagsFromCache(message) {
|
|||
}
|
||||
|
||||
if (0 < message.threads().length) {
|
||||
const unseenSubUid = _.find(message.threads(), (sSubUid) => {
|
||||
const unseenSubUid = message.threads().find(sSubUid => {
|
||||
if (uid !== sSubUid) {
|
||||
const subFlags = getMessageFlagsFromCache(message.folderFullNameRaw, sSubUid);
|
||||
return subFlags && 0 < subFlags.length && !!subFlags[0];
|
||||
|
|
@ -231,7 +230,7 @@ export function initMessageFlagsFromCache(message) {
|
|||
return false;
|
||||
});
|
||||
|
||||
const flaggedSubUid = _.find(message.threads(), (sSubUid) => {
|
||||
const flaggedSubUid = message.threads().find(sSubUid => {
|
||||
if (uid !== sSubUid) {
|
||||
const subFlags = getMessageFlagsFromCache(message.folderFullNameRaw, sSubUid);
|
||||
return subFlags && 0 < subFlags.length && !!subFlags[1];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import window from 'window';
|
||||
import _ from '_';
|
||||
import $ from '$';
|
||||
import key from 'key';
|
||||
import ko from 'ko';
|
||||
|
|
@ -152,15 +151,7 @@ export const htmlEditorLangsMap = {
|
|||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
let bAllowPdfPreview = !bMobileDevice;
|
||||
|
||||
if (bAllowPdfPreview && window.navigator && window.navigator.mimeTypes) {
|
||||
bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, (type) => type && 'application/pdf' === type.type);
|
||||
|
||||
if (!bAllowPdfPreview) {
|
||||
bAllowPdfPreview = 'undefined' !== typeof window.navigator.mimeTypes['application/pdf'];
|
||||
}
|
||||
}
|
||||
let bAllowPdfPreview = !bMobileDevice && undefined !== window.navigator.mimeTypes['application/pdf'];
|
||||
|
||||
export { bAllowPdfPreview };
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ class Selector {
|
|||
} else if (0 < aItems.length) {
|
||||
if (null !== isNextFocused) {
|
||||
getNext = false;
|
||||
isNextFocused = _.find(aCache, (sUid) => {
|
||||
isNextFocused = aCache.find(sUid => {
|
||||
if (getNext && uids.includes(sUid)) {
|
||||
return sUid;
|
||||
} else if (isNextFocused === sUid) {
|
||||
|
|
@ -190,7 +190,7 @@ class Selector {
|
|||
});
|
||||
|
||||
if (isNextFocused) {
|
||||
temp = _.find(aItems, (oItem) => isNextFocused === this.getItemUid(oItem));
|
||||
temp = aItems.find(oItem => isNextFocused === this.getItemUid(oItem));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1018,7 +1018,7 @@ export function selectElement(element) {
|
|||
}
|
||||
|
||||
export const detectDropdownVisibility = _.debounce(() => {
|
||||
dropdownVisibility(!!_.find(GlobalsData.aBootstrapDropdowns, (item) => item.hasClass('open')));
|
||||
dropdownVisibility(!!GlobalsData.aBootstrapDropdowns.find(item => item.hasClass('open')));
|
||||
}, 50);
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue