mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
Object.entries().forEach() to forEachObjectEntry()
This commit is contained in:
parent
b8eb8f83fa
commit
6d7911a9ed
8 changed files with 18 additions and 18 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { isArray, isFunction, addObservablesTo, addComputablesTo, forEachObjectValue } from 'Common/Utils';
|
||||
import { isArray, isFunction, addObservablesTo, addComputablesTo, forEachObjectValue, forEachObjectEntry } from 'Common/Utils';
|
||||
|
||||
function dispose(disposable) {
|
||||
if (disposable && isFunction(disposable.dispose)) {
|
||||
|
|
@ -43,7 +43,7 @@ export class AbstractModel {
|
|||
}
|
||||
|
||||
addSubscribables(subscribables) {
|
||||
Object.entries(subscribables).forEach(([key, fn]) => this.subscribables.push( this[key].subscribe(fn) ) );
|
||||
forEachObjectEntry(subscribables, (key, fn) => this.subscribables.push( this[key].subscribe(fn) ) );
|
||||
}
|
||||
|
||||
/** Called by delegateRunOnDestroy */
|
||||
|
|
@ -51,7 +51,7 @@ export class AbstractModel {
|
|||
/** dispose ko subscribables */
|
||||
this.subscribables.forEach(dispose);
|
||||
/** clear object entries */
|
||||
// Object.entries(this).forEach(([key, value]) => {
|
||||
// forEachObjectEntry(this, (key, value) => {
|
||||
forEachObjectValue(this, value => {
|
||||
/** clear CollectionModel */
|
||||
let arr = ko.isObservableArray(value) ? value() : value;
|
||||
|
|
@ -89,7 +89,7 @@ export class AbstractModel {
|
|||
if (!model.validJson(json)) {
|
||||
return false;
|
||||
}
|
||||
Object.entries(json).forEach(([key, value]) => {
|
||||
forEachObjectEntry(json, (key, value) => {
|
||||
if ('@' !== key[0]) try {
|
||||
key = key[0].toLowerCase() + key.substr(1);
|
||||
switch (typeof this[key])
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { doc, $htmlCL, elementById } from 'Common/Globals';
|
||||
import { isFunction, forEachObjectValue } from 'Common/Utils';
|
||||
import { isFunction, forEachObjectValue, forEachObjectEntry } from 'Common/Utils';
|
||||
|
||||
let
|
||||
SCREENS = {},
|
||||
|
|
@ -349,7 +349,7 @@ export const
|
|||
},
|
||||
|
||||
decorateKoCommands = (thisArg, commands) =>
|
||||
Object.entries(commands).forEach(([key, canExecute]) => {
|
||||
forEachObjectEntry(commands, (key, canExecute) => {
|
||||
let command = thisArg[key],
|
||||
fn = (...args) => fn.enabled() && fn.canExecute() && command.apply(thisArg, args);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue