« get me outta code hell

use atOffset() and .at() where appropriate - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/yaml.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-14 16:54:45 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-14 16:54:45 -0400
commit6572bd0951d506e4a91366da2ae8d710d5a13a93 (patch)
tree7c95df9fb52eb79ff319e013474ffeae83e79325 /src/data/yaml.js
parent40068a42c31bd25ae62f519146513da5f689c1e7 (diff)
use atOffset() and .at() where appropriate
Diffstat (limited to 'src/data/yaml.js')
-rw-r--r--src/data/yaml.js11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 2137f99..5a4e87e 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -17,6 +17,7 @@ import T, {Thing} from '#things';
 
 import {
   annotateErrorWithFile,
+  atOffset,
   conditionallySuppressError,
   decorateErrorWithIndex,
   decorateErrorWithAnnotation,
@@ -1237,14 +1238,8 @@ export async function loadAndProcessDataDocuments({dataPath}) {
                   start,
                   end,
                   count: end - start + 1,
-                  previous:
-                    (start > 0
-                      ? documents[start - 1]
-                      : null),
-                  next:
-                    (end < documents.length - 1
-                      ? documents[end + 1]
-                      : null),
+                  previous: atOffset(documents, start, -1),
+                  next: atOffset(documents, end, +1),
                 }));
 
             for (const {start, end, count, previous, next} of blankIndexRangeInfo) {