Skip to content

Commit

Permalink
fix(proxy): handle props with falsy values
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Jan 31, 2018
1 parent dacaec1 commit d2f80f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PromiseModule {
const handler = {
get: (target, name) => {
if (target.cache.has(name)) return target.cache.get(name)
if (target.mod[name]) {
if (name in target.mod) {
let val
if (typeof target.mod[name] === 'function') {
val = (...args) => promisify(cb => target.mod[name](...args, cb))()
Expand Down
7 changes: 7 additions & 0 deletions test/test-basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@ test('unknown function', t => {
let mod = promwrap(_module)
t.throws(() => mod.foo())
})

test('falsy props', t => {
t.plan(1)
let mod = promwrap(_module)
_module.prop2 = false
t.same(mod.prop2, false)
})

0 comments on commit d2f80f4

Please sign in to comment.