Skip to content

Commit 435b12c

Browse files
committed
Fix getAll
1 parent 1e7030e commit 435b12c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ module.exports = {
2727
// Get all values starting with a certain pathname and filter their views
2828
getAll: async function getAll(options) {
2929
const data = {}
30-
const keys = await module.exports.keys()
30+
const keys = (await module.exports.keys()).filter(key => key.startsWith(options.pathname))
3131

32-
keys
33-
.filter(key => key.startsWith(options.pathname))
34-
.forEach((key) => {
35-
data[key] = module.exports.get(key, { before: options.before, after: options.after })
36-
})
32+
for (let key of keys) {
33+
data[key] = await module.exports.get(key, { before: options.before, after: options.after })
34+
}
35+
36+
await Promise.all(keys)
3737

3838
return data
3939
}

0 commit comments

Comments
 (0)