Skip to content

Commit ce6cac6

Browse files
committed
fix(all.js): do not set properties name to function
fixed #1
1 parent 08d46e4 commit ce6cac6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

all.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = function (source, destination, methods) {
3030

3131
methods.forEach(function (name) {
3232
// promisify only if it's a function
33-
if (typeof source[name] === 'function') destination[name] = promisify(name, source[name])
33+
if (typeof source[name] === 'function') destination[name] = promisify(source[name])
3434
})
3535

3636
// proxy the rest

test/all.test.js

+9
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,13 @@ describe('callback-and-promise/all', function () {
4646
assert(stat.size, fs.statSync(__filename).size)
4747
})
4848
})
49+
50+
it('promisifyAll with reserved words', function () {
51+
var module = {
52+
delete: function () {}
53+
}
54+
module = thenify(module)
55+
assert(typeof module.delete.name, 'function')
56+
assert(module.delete.name, 'anonymous')
57+
})
4958
})

0 commit comments

Comments
 (0)