Skip to content

Commit 2d25c95

Browse files
committed
Create categoriesHandlers.js
1 parent e5bd748 commit 2d25c95

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/lib/categoriesHandlers.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
const getCategoriesFlags = array => {
3+
return (!Array.isEmpty(array) ?? false) ? `--only-categories=${lighthouseCategories(array ?? "accessibility")} ` : ""
4+
}
5+
6+
const getCurrentCategories = categories => {
7+
return categories ?? ["accessibility", "pwa", "best-practices", "performance", "seo"]
8+
}
9+
10+
const lighthouseCategories = (categories = []) => {
11+
return (typeof categories == "string") ? categories : categories.join(',')
12+
}
13+
14+
const getCategoriesFromCategoriesFlags = array => {
15+
return (!Array.isEmpty(array)) ? array : undefined
16+
}
17+
18+
export { getCategoriesFlags, lighthouseCategories, getCurrentCategories, getCategoriesFromCategoriesFlags }

0 commit comments

Comments
 (0)