debian/tests/test_modules/call-me-maybe/src/maybe.js
raw| 1 | "use strict" |
| 2 | |
| 3 | var next = require('./next.js') |
| 4 | |
| 5 | module.exports = function maybe (cb, promise) { |
| 6 | if (cb) { |
| 7 | promise |
| 8 | .then(function (result) { |
| 9 | next(function () { cb(null, result) }) |
| 10 | }, function (err) { |
| 11 | next(function () { cb(err) }) |
| 12 | }) |
| 13 | return undefined |
| 14 | } |
| 15 | else { |
| 16 | return promise |
| 17 | } |
| 18 | } |