1
Fork 0

Replace usage of null with undefined.

This commit is contained in:
Bauke 2022-03-28 15:18:16 +02:00
parent 8c8c8970d8
commit 2d2778df9d
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 5 additions and 5 deletions

View File

@ -40,24 +40,24 @@ async function getCurrentListen() {
const result = await window.fetch('https://api.listenbrainz.org/1/user/BaukeXYZ/playing-now');
if (!result.ok) {
console.warn(result.status);
return null;
return;
}
const data = await result.json();
if (data.payload.listens.length === 0) {
return null;
return;
}
return data.payload.listens[0];
}
function insertHtml(listen, image) {
if (listen === null) {
if (listen === undefined) {
return;
}
const existing = document.querySelector('.listenbrainz');
if (existing !== null) {
const existing = document.querySelector('.listenbrainz') ?? undefined;
if (existing !== undefined) {
existing.remove();
}