« get me outta code hell

new "empty" sugar.js util - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-11-21 21:48:31 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-11-21 21:48:31 -0400
commitba2751eae00c4bcf10403edbd549ca70dc316cab (patch)
tree492537e39b268dd1991bc85ffb2e4c666ff03536 /src/data
parent860b9fbf12315362d2c33864521c3f081fd66545 (diff)
new "empty" sugar.js util
Diffstat (limited to 'src/data')
-rw-r--r--src/data/yaml.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 2c3c988d..e18b7334 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -31,6 +31,7 @@ import {color, ENABLE_COLOR, logInfo, logWarn} from '../util/cli.js';
 
 import {
   decorateErrorWithIndex,
+  empty,
   mapAggregate,
   openAggregate,
   showAggregate,
@@ -143,7 +144,7 @@ function makeProcessDocument(
       .map(([field]) => field)
       .filter((field) => !knownFields.includes(field));
 
-    if (unknownFields.length) {
+    if (!empty(unknownFields)) {
       throw new makeProcessDocument.UnknownFieldsError(unknownFields);
     }
 
@@ -1253,7 +1254,7 @@ export function filterDuplicateDirectories(wikiData) {
             directoryPlaces[directory] = [thing];
           }
         }
-        if (!duplicateDirectories.length) return;
+        if (empty(duplicateDirectories)) return;
         duplicateDirectories.sort((a, b) => {
           const aL = a.toLowerCase();
           const bL = b.toLowerCase();