"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports["default"] = function () {
  var PromiseArg = arguments[0] === undefined ? Promise : arguments[0];
  return function (f) {
    return function () {
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }

      return new PromiseArg(function (resolve, reject) {
        return f.apply(undefined, args.concat([function (err, val) {
          return err ? reject(err) : resolve(val);
        }]));
      });
    };
  };
};

module.exports = exports["default"];

