Skip to content

Commit

Permalink
boom
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Jun 6, 2015
1 parent 16a73ac commit 07a2362
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@

'use strict'

var fnName = require('fn.name')
var handleArguments = require('handle-arguments')

module.exports = function makeCallback (fn) {
if (typeof fn !== 'function') {
throw new TypeError('make-callback expect a function')
}

return function () {
var argz = handleArguments(arguments)

if (!argz.callback) {
var name = fnName(fn)
throw new TypeError('async `fn` (' + name + ') expect a callback')
throw new TypeError('async `fn` expect a callback')
}

var res = false
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
},
"dependencies": {
"fn.name": "~1.0.1",
"handle-arguments": "~3.0.2"
"handle-arguments": "~3.0.2",
"is-sync-function": "0.0.0"
},
"devDependencies": {
"assertit": "^0.1.0"
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test('make-callback:', function () {
}

test.throws(fixture, TypeError)
test.throws(fixture, /async `fn` .* expect a callback/)
test.throws(fixture, /async `fn` expect a callback/)
done()
})
test('should pass result to callback', function (done) {
Expand Down

0 comments on commit 07a2362

Please sign in to comment.