Comparing version 1.0.6 to 1.0.7
"use strict"; | ||
var _promise = require("babel-runtime/core-js/promise"); | ||
var _promise2 = _interopRequireDefault(_promise); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var noop = require("noop6"), | ||
@@ -23,11 +29,10 @@ sliced = require("sliced"); | ||
module.exports = function assured(fn, p) { | ||
p = p || Promise; | ||
p = p || _promise2.default; | ||
fn = fn || noop; | ||
var res = function res(err) { | ||
fn.apply(res, arguments); | ||
if (err) { | ||
fn(err); | ||
res.assuredReject(err); | ||
} else { | ||
fn.apply(res, arguments); | ||
res.assuredResolve.apply(res, sliced(arguments, 1)); | ||
@@ -44,3 +49,4 @@ } | ||
res._ = new p(res.resolver); | ||
res._.catch(noop); | ||
return res; | ||
}; |
@@ -13,3 +13,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"main": "lib/index.js", | ||
@@ -16,0 +16,0 @@ "scripts": { |
@@ -0,1 +1,2 @@ | ||
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. --> | ||
@@ -70,2 +71,4 @@ # assured | ||
## :question: Get Help | ||
@@ -77,3 +80,3 @@ | ||
2. For bug reports and feature requests, open issues. :bug: | ||
3. For direct and quick help from me, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket: | ||
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket: | ||
@@ -88,2 +91,3 @@ | ||
#### Params | ||
- **Function** `fn`: The callback function to proxy. | ||
@@ -90,0 +94,0 @@ - **Promise** `p`: A custom promise constructor (default: the built-in `Promise`). |
8198
41
147