« 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/generateFlashActNavAccent.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/generateFlashActNavAccent.js
parent40068a42c31bd25ae62f519146513da5f689c1e7 (diff)
use atOffset() and .at() where appropriate
Diffstat (limited to 'src/content/dependencies/generateFlashActNavAccent.js')
-rw-r--r--src/content/dependencies/generateFlashActNavAccent.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/content/dependencies/generateFlashActNavAccent.js b/src/content/dependencies/generateFlashActNavAccent.js
index 9850438..424948f 100644
--- a/src/content/dependencies/generateFlashActNavAccent.js
+++ b/src/content/dependencies/generateFlashActNavAccent.js
@@ -1,4 +1,4 @@
-import {empty} from '#sugar';
+import {atOffset, empty} from '#sugar';
 
 export default {
   contentDependencies: [
@@ -17,17 +17,14 @@ export default {
     const flashActs =
       sprawl.flashActData;
 
-    const index = flashActs.indexOf(flashAct);
+    const index =
+      flashActs.indexOf(flashAct);
 
     const previousFlashAct =
-      (index > 0
-        ? flashActs[index - 1]
-        : null);
+      atOffset(flashActs, index, -1);
 
     const nextFlashAct =
-      (index < flashActs.length - 1
-        ? flashActs[index + 1]
-        : null);
+      atOffset(flashActs, index, +1);
 
     return {previousFlashAct, nextFlashAct};
   },