Skip to content

Commit ab68fff

Browse files
committed
fix(index): Check fn argument type
Throw an error when the fn argument is not of type function
1 parent 566b997 commit ab68fff

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
'use strict'
22

33
function promisify (fn) {
4+
if (typeof fn !== 'function') {
5+
throw new Error('fn parameter must be a function')
6+
}
47
return function () {
58
const args = Array.prototype.slice.call(arguments)
69
return new Promise(function (resolve, reject) {

0 commit comments

Comments
 (0)