Skip to content

Commit 60e2988

Browse files
chore: optimized icon detection in build script (#1708)
1 parent 24a3bce commit 60e2988

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

build/ast.mjs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,23 @@ const getSoftwareName = (obj, result = { title: '' }) => {
3535
}
3636

3737
const getIconDetail = (data, url = '') => {
38-
if (data.type === 'imageReference' && data.identifier && /^(freeware\s+icon|oss\s+icon|app-store\s+icon|awesome-list\s+icon)/.test(data.identifier.toLocaleLowerCase())) {
39-
let type = ''
40-
if (/^(freeware\s+icon)/.test(data.identifier.toLocaleLowerCase())) {
41-
type = 'freeware'
42-
}
43-
if (/^(oss\s+icon)/.test(data.identifier.toLocaleLowerCase())) {
44-
type = 'oss'
45-
}
46-
if (/^(app-store\s+icon)/.test(data.identifier.toLocaleLowerCase())) {
47-
type = 'app-store'
48-
}
49-
if (/^(awesome-list\s+icon)/.test(data.identifier.toLocaleLowerCase())) {
50-
type = 'awesome-list'
51-
}
52-
return { type, url }
38+
if (data.type === 'imageReference' && data.identifier) {
39+
const identifier = data.identifier.toLocaleLowerCase()
40+
if (/^(freeware\s+icon|oss\s+icon|app-store\s+icon|awesome-list\s+icon)/.test(identifier)) {
41+
let type = ''
42+
if (/^(freeware\s+icon)/.test(identifier)) {
43+
type = 'freeware'
44+
}
45+
if (/^(oss\s+icon)/.test(identifier)) {
46+
type = 'oss'
47+
}
48+
if (/^(app-store\s+icon)/.test(identifier)) {
49+
type = 'app-store'
50+
}
51+
if (/^(awesome-list\s+icon)/.test(identifier)) {
52+
type = 'awesome-list'
53+
}
54+
return { type, url }
5355
}
5456
return false
5557
}

0 commit comments

Comments
 (0)