From ba2751eae00c4bcf10403edbd549ca70dc316cab Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 21 Nov 2022 21:48:31 -0400 Subject: new "empty" sugar.js util --- src/data/yaml.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/data') 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(); -- cgit 1.3.0-6-gf8a5