Array.isArray to isArray

Array.isNotEmpty to isNonEmptyArray
This commit is contained in:
djmaze 2021-03-16 16:49:14 +01:00
parent 986b8f056b
commit 0b64083543
30 changed files with 82 additions and 69 deletions

View file

@ -3,7 +3,7 @@ import { doc, elementById } from 'Common/Globals';
export const
isArray = Array.isArray,
isNonEmptyArray = Array.isNotEmpty;
isNonEmptyArray = array => isArray(array) && array.length;
/**
* @param {*} value
@ -116,7 +116,7 @@ export function changeTheme(value, themeTrigger = ()=>{}) {
}
rl.fetchJSON(url, init)
.then(data => {
if (data && Array.isArray(data) && 2 === data.length) {
if (data && isArray(data) && 2 === data.length) {
if (themeLink && !themeStyle) {
themeStyle = doc.createElement('style');
themeStyle.id = 'app-theme-style';
@ -139,7 +139,7 @@ export function changeTheme(value, themeTrigger = ()=>{}) {
export function addObservablesTo(target, observables) {
Object.entries(observables).forEach(([key, value]) =>
target[key] = /*Array.isArray(value) ? ko.observableArray(value) :*/ ko.observable(value) );
target[key] = /*isArray(value) ? ko.observableArray(value) :*/ ko.observable(value) );
}
export function addComputablesTo(target, computables) {