Skip to content

Commit 384372d

Browse files
committed
chore: mesure init sur mon portefolio pour l'améliorer, fix null condition for best-pratice
1 parent 1ebfc84 commit 384372d

File tree

2 files changed

+5097
-5
lines changed

2 files changed

+5097
-5
lines changed

lib/best-practice.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function extractUrls(result: Result, key: string): string[] {
2626
// @ts-expect-error I dont know how to get the type from lighthouse here.
2727
const items = audit.details.items
2828

29-
if (!Array.isArray(items)) {
29+
if (!Array.isArray(items) || items.length === 0) {
3030
return []
3131
}
3232

@@ -231,7 +231,7 @@ export class BPUnusedCode implements BestPractice {
231231
// @ts-expect-error I dont know how to get the type from lighthouse here.
232232
const items = audit.details.items
233233

234-
if (!Array.isArray(items)) {
234+
if (!Array.isArray(items) || items.length === 0) {
235235
return 0
236236
}
237237

@@ -252,7 +252,7 @@ export class BPUnusedCode implements BestPractice {
252252
// @ts-expect-error I dont know how to get the type from lighthouse here.
253253
const items = audit.details.items
254254

255-
if (!Array.isArray(items)) {
255+
if (!Array.isArray(items) || items.length === 0) {
256256
return 0
257257
}
258258

@@ -312,7 +312,7 @@ export class BPWebfont implements BestPractice {
312312
// @ts-expect-error I dont know how to get the type from lighthouse here.
313313
const items = audit.details.items
314314

315-
if (!Array.isArray(items)) {
315+
if (!Array.isArray(items) || items.length === 0) {
316316
return [0, []]
317317
}
318318

@@ -361,7 +361,7 @@ export class BPHttpFlux implements BestPractice {
361361
// @ts-expect-error I dont know how to get the type from lighthouse here.
362362
const items = audit.details.items
363363

364-
if (!Array.isArray(items)) {
364+
if (!Array.isArray(items) || items.length === 0) {
365365
return []
366366
}
367367

0 commit comments

Comments
 (0)