We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e0145c8 commit c11b56cCopy full SHA for c11b56c
app/site/src/components/Item.vue
@@ -29,14 +29,16 @@ export default {
29
props: ['item'],
30
mixins: [filterByTag],
31
computed: {
32
+ /**
33
+ * Get a shields.io badge URL for a GitHub repository.
34
+ * @return {String|null}
35
+ */
36
githubBadgeUrl() {
37
const re = /https?:\/\/github\.com\/([A-Za-z0-9-_]*)\/([A-Za-z0-9-_]*)\/?$/i
38
const matches = re.exec(this.item.url)
- if (!matches) {
- return null
- }
-
39
- return `https://img.shields.io/github/stars/${matches[1]}/${matches[2]}.svg?style=social&label=★`
+ return matches
40
+ ? `https://img.shields.io/github/stars/${matches[1]}/${matches[2]}.svg?style=social&label=★`
41
+ : null
42
}
43
44
0 commit comments