Skip to content

Commit 982f9e1

Browse files
committed
simplify and fix
Signed-off-by: Haroen Viaene <[email protected]>
1 parent 77ed9a7 commit 982f9e1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

packages/gatsby-source-npm-package-search/src/gatsby-node.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,15 @@ exports.sourceNodes = async (
2929

3030
console.log(`Grabbing local NPM packages...`)
3131

32-
let buildFilter = []
32+
const buildFilter = keywords.map(keyword => `keywords:${keyword}`)
3333

34-
keywords.forEach(keyword => {
35-
buildFilter.push(`keywords:${keyword}`)
36-
})
37-
38-
const data = await browse({
34+
const hits = await browse({
3935
index,
4036
filters: `(${buildFilter.join(` OR `)})`,
4137
hitsPerPage: 1000,
4238
})
4339

44-
data.hits.forEach(hit => {
40+
hits.forEach(hit => {
4541
// commented changed remove all badges and images from readme content to keep the creation of the node from failing below
4642
// if (hit.readme.includes(`![`)) {
4743
// hit.readme = hit.readme.replace(/[[]?!\[.*\b/gi, ``)

0 commit comments

Comments
 (0)