Skip to content

Commit c8413be

Browse files
committed
Update categoriesHandlers.class.js renaming and add legacy support
1 parent 3159d6e commit c8413be

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed
Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
import Utility from './utilities.class.js'
22

33
class Categories {
4-
getCategoriesFlags = array => {
5-
return (!Array.isEmpty(array) ?? false) ? `--only-categories=${lighthouseCategories(array ?? "accessibility")} ` : ""
4+
// getCategoriesFlags = array => {
5+
getFlags = array => {
6+
return (!Utility.isEmpty(array) ?? false) ? `--only-categories=${lighthouseCategories(array ?? "accessibility")} ` : ""
67
}
78

8-
getCurrentCategories = categories => {
9+
// getCurrentCategories = categories => {
10+
getCurrent = categories => {
911
return categories ?? ["accessibility", "pwa", "best-practices", "performance", "seo"]
1012
}
1113

12-
lighthouseCategories = (categories = []) => {
14+
// lighthouseCategories = (categories = []) => {
15+
lighthouse = (categories = []) => {
1316
return (typeof categories == "string") ? categories : categories.join(',')
1417
}
1518

16-
getCategoriesFromCategoriesFlags = array => {
19+
// getCategoriesFromCategoriesFlags = array => {
20+
getFromFlags = array => {
1721
return (!Utility.isEmpty(array)) ? array : undefined
1822
}
1923
}
2024

21-
export const { getCategoriesFlags, lighthouseCategories, getCurrentCategories, getCategoriesFromCategoriesFlags } = new Categories()
22-
export default Categories
25+
export const {
26+
getFlags: getCategoriesFlags, // deprecated: only use this for non-class implementation
27+
lighthouse: lighthouseCategories, // deprecated: only use this for non-class implementation
28+
getCurrent: getCurrentCategories, // deprecated: only use this for non-class implementation
29+
getFromFlags: getCategoriesFromCategoriesFlags // deprecated: only use this for non-class implementation
30+
} = new Categories()
31+
export default new Categories()

0 commit comments

Comments
 (0)