.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / call-me-maybe / index.js
1 "use strict"
2
3 var next = (global.process && process.nextTick) || global.setImmediate || function (f) {
4   setTimeout(f, 0)
5 }
6
7 module.exports = function maybe (cb, promise) {
8   if (cb) {
9     promise
10       .then(function (result) {
11         next(function () { cb(null, result) })
12       }, function (err) {
13         next(function () { cb(err) })
14       })
15     return undefined
16   }
17   else {
18     return promise
19   }
20 }