« get me outta code hell

use accumulateSum util where appropriate - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-11-26 23:48:16 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-11-26 23:48:16 -0400
commit0ff89848bd7252c3dfc840bc40a0bd6a9d1376bd (patch)
tree45c1379b6631473d10892a29693d7f7829942b69 /src/util
parent003f594f6348b55109dd66416e75fcc2a88faade (diff)
use accumulateSum util where appropriate
Diffstat (limited to 'src/util')
-rw-r--r--src/util/wiki-data.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js
index 7d2cfa9f..f044b2a1 100644
--- a/src/util/wiki-data.js
+++ b/src/util/wiki-data.js
@@ -1,6 +1,9 @@
 // Utility functions for interacting with wiki data.
 
-import {empty} from './sugar.js';
+import {
+  accumulateSum,
+  empty,
+} from './sugar.js';
 
 // Generic value operations
 
@@ -382,7 +385,7 @@ export function getFlashLink(flash) {
 }
 
 export function getTotalDuration(tracks) {
-  return tracks.reduce((duration, track) => duration + track.duration, 0);
+  return accumulateSum(tracks, track => track.duration);
 }
 
 export function getTrackCover(track, {to}) {