« get me outta code hell

don't duplic8 contrib&artist trax on artist pages! - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/upd8-util.js
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-02-07 11:05:50 -0400
committer(quasar) nebula <towerofnix@gmail.com>2021-02-07 11:05:50 -0400
commit1322f423ffcb76ce532ce584b138d648d6b0df95 (patch)
tree37f88908f715eae7f73c2422aaf098dd015fb7b8 /upd8-util.js
parent5fcbce1f9e62c780e1ac3fe6161e4a70ba09d86a (diff)
don't duplic8 contrib&artist trax on artist pages!
if an artist is both an artist and contributor for a track, that track
would show up twice on the artist page, and with the exact same line,
due to the way the artist track list is constructed. this started
happening because we combine the "as contributor" and "as artist" arrays
for a given artist, which can have overlap! so now we throw a unique()
utility function on top and it works like its supposed to.
Diffstat (limited to 'upd8-util.js')
-rw-r--r--upd8-util.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/upd8-util.js b/upd8-util.js
index a266efb..b18c052 100644
--- a/upd8-util.js
+++ b/upd8-util.js
@@ -304,3 +304,5 @@ module.exports.curry = f => x => (...args) => f(x, ...args);
 module.exports.mapInPlace = (array, fn) => array.splice(0, array.length, ...array.map(fn));
 
 module.exports.filterEmptyLines = string => string.split('\n').filter(line => line.trim()).join('\n');
+
+module.exports.unique = arr => Array.from(new Set(arr));