diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-06-09 17:01:36 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-09 17:53:30 -0300 |
commit | 36e2006bc9a24918ba886d9cef28d6288bf01c40 (patch) | |
tree | 114187513349e965bf0aa5a49bb5f694748390f0 /src/content/util | |
parent | 7cf49b34db0a9aeee201594704798b69035c7036 (diff) |
content: generateTrackListDividedByGroups: inline util function
Diffstat (limited to 'src/content/util')
-rw-r--r-- | src/content/util/groupTracksByGroup.js | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/content/util/groupTracksByGroup.js b/src/content/util/groupTracksByGroup.js deleted file mode 100644 index 4e189007..00000000 --- a/src/content/util/groupTracksByGroup.js +++ /dev/null @@ -1,23 +0,0 @@ -import {empty} from '#sugar'; - -export default function groupTracksByGroup(tracks, groups) { - const lists = new Map(groups.map(group => [group, []])); - lists.set('other', []); - - for (const track of tracks) { - const group = groups.find(group => group.albums.includes(track.album)); - if (group) { - lists.get(group).push(track); - } else { - lists.get('other').push(track); - } - } - - for (const [key, tracks] of lists.entries()) { - if (empty(tracks)) { - lists.delete(key); - } - } - - return lists; -} |