Skip to content

Commit

Permalink
fix(app): applyEachWith only acts on functions
Browse files Browse the repository at this point in the history
`db.app.packageCollection` was turned into a function
now users will able to get to the constant value.
  • Loading branch information
line-o committed Aug 5, 2022
1 parent 4c67c7c commit ea30bbb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ function applyWith (func, client) {
}

function applyEachWith (module, client) {
const methods = {}
for (const method in module) {
methods[method] = applyWith(module[method], client)
const applied = {}
for (const property in module) {
const value = module[property]
// leave non-functions untouched
if (typeof value !== 'function') {
applied[property] = value
continue
}
applied[property] = applyWith(value, client)
}
return methods
return applied
}

/**
Expand Down

0 comments on commit ea30bbb

Please sign in to comment.