diff options
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) ); } |