« 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/content/dependencies/generateFlashNavAccent.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/content/dependencies/generateFlashNavAccent.js
parent40068a42c31bd25ae62f519146513da5f689c1e7 (diff)
use atOffset() and .at() where appropriate
Diffstat (limited to 'src/content/dependencies/generateFlashNavAccent.js')
-rw-r--r--src/content/dependencies/generateFlashNavAccent.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/content/dependencies/generateFlashNavAccent.js b/src/content/dependencies/generateFlashNavAccent.js
index 57196d06..55e056dc 100644
--- a/src/content/dependencies/generateFlashNavAccent.js
+++ b/src/content/dependencies/generateFlashNavAccent.js
@@ -1,4 +1,4 @@
-import {empty} from '#sugar';
+import {atOffset, empty} from '#sugar';
 
 export default {
   contentDependencies: [
@@ -19,17 +19,14 @@ export default {
       sprawl.flashActData
         .flatMap(act => act.flashes);
 
-    const index = flashes.indexOf(flash);
+    const index =
+      flashes.indexOf(flash);
 
     const previousFlash =
-      (index > 0
-        ? flashes[index - 1]
-        : null);
+      atOffset(flashes, index, -1);
 
     const nextFlash =
-      (index < flashes.length - 1
-        ? flashes[index + 1]
-        : null);
+      atOffset(flashes, index, +1);
 
     return {previousFlash, nextFlash};
   },