isNonEmptyArray => arrayLength

This commit is contained in:
djmaze 2021-07-21 21:34:17 +02:00
parent 1e49c1a6ac
commit 5590fd4860
20 changed files with 68 additions and 74 deletions

View file

@ -3,7 +3,7 @@ import { doc, elementById } from 'Common/Globals';
export const
isArray = Array.isArray,
isNonEmptyArray = array => isArray(array) && array.length,
arrayLength = array => isArray(array) && array.length,
isFunction = v => typeof v === 'function';
/**
@ -116,7 +116,7 @@ export function changeTheme(value, themeTrigger = ()=>{}) {
}
rl.fetchJSON(url, init)
.then(data => {
if (data && isArray(data) && 2 === data.length) {
if (2 === arrayLength(data)) {
themeStyle.textContent = data[1];
themeStyle.dataset.href = url;
themeStyle.dataset.theme = data[0];