diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-02-17 23:23:35 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-02-17 23:25:59 -0400 |
commit | f26ad2e27e9c7ca61b6ae5e9b3587786d911a2df (patch) | |
tree | a611d91cab993d84cda1dd81af7be741295e248a /src/util | |
parent | f8557485ac06a7b2527c50dcf638497212678a16 (diff) |
pre-writes: listings
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/find.js | 6 | ||||
-rw-r--r-- | src/util/wiki-data.js | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/util/find.js b/src/util/find.js index a9af2384..872b3b7a 100644 --- a/src/util/find.js +++ b/src/util/find.js @@ -25,6 +25,10 @@ function findHelper(keys, dataProp, findFns = {}) { const data = wikiData[dataProp]; + if (!data) { + throw new Error(`Expected data to be present`); + } + const found = (key ? byDirectory(ref, data, quiet) : byName(ref, data, quiet)); @@ -76,12 +80,12 @@ function matchTagName(ref, data, quiet) { const find = { album: findHelper(['album', 'album-commentary'], 'albumData'), artist: findHelper(['artist', 'artist-gallery'], 'artistData'), + artTag: findHelper(['tag'], 'artTagData', {byName: matchTagName}), flash: findHelper(['flash'], 'flashData'), group: findHelper(['group', 'group-gallery'], 'groupData'), listing: findHelper(['listing'], 'listingSpec'), newsEntry: findHelper(['news-entry'], 'newsData'), staticPage: findHelper(['static'], 'staticPageData'), - tag: findHelper(['tag'], 'artTagData', {byName: matchTagName}), track: findHelper(['track'], 'trackData') }; diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js index 2f705f91..41071d17 100644 --- a/src/util/wiki-data.js +++ b/src/util/wiki-data.js @@ -129,9 +129,9 @@ export function getAllTracks(albumData) { export function getArtistNumContributions(artist) { return ( - artist.tracks.asAny.length + - artist.albums.asCoverArtist.length + - (artist.flashes ? artist.flashes.asContributor.length : 0) + (artist.tracksAsAny?.length ?? 0) + + (artist.albumsAsCoverArtist?.length ?? 0) + + (artist.flashesAsContributor?.length ?? 0) ); } |