Skip to content

Commit

Permalink
chore(docs): Fix search awesome (#2842)
Browse files Browse the repository at this point in the history
  • Loading branch information
fratzinger authored Nov 1, 2022
1 parent f66177d commit ec94421
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
2 changes: 0 additions & 2 deletions docs/awesome/PackageCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ const formatDistance = (date: Date, baseDate: Date) => {
try {
return _formatDistance(date, new Date())
} catch (err) {
console.error(err)
return ''
}
}
const formatDate = (date: Date) => {
try {
return intlFormat.format(date)
} catch (err) {
console.error(err)
return ''
}
}
Expand Down
6 changes: 1 addition & 5 deletions docs/awesome/Packages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ async function getPackageStats(): Promise<PackageOutput[]> {
pkg.hasNPM = hasNPM
})
console.log(packages)
const uniq = uniqBy(packages, (pkg) => pkg.id)
console.log(uniq)
return uniq
}
Expand Down Expand Up @@ -110,7 +107,7 @@ const filteredPackages = computed(() => {
const _search = search.value.toLowerCase()
pkgs = pkgs.filter(
(pkg) =>
pkg.name.includes(_search) ||
pkg.id.includes(_search) ||
pkg.description?.includes(_search) ||
pkg.keywords?.some((keyword) => keyword.includes(_search))
)
Expand Down Expand Up @@ -144,7 +141,6 @@ const packagesToShow = computed(() => {
return 0
}
})
console.log(result.map((x) => x[key]))
return result
})
</script>
Expand Down
2 changes: 0 additions & 2 deletions docs/awesome/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export const uniqBy = <T = any, V = any>(arr: T[], selector: (item: T) => V) =>
const map = new Map<V, T>()
arr.forEach((item) => {
const prop = selector(item)
console.log(prop)
if (!map.has(prop)) map.set(prop, item)
})
console.log(map.values())
return [...map.values()]
}

0 comments on commit ec94421

Please # to comment.