"use strict";

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

function toResultObject() {
  return promise => {
    return promise.then(val => ({
      success: true,
      val
    })).catch(error => ({
      success: false,
      error,
      val: null
    }));
  };
}