Comparing version 2.0.0 to 2.0.1
21
index.js
@@ -25,3 +25,3 @@ import ResultType from 'result-type' | ||
default: | ||
var x = pending() | ||
const x = pending() | ||
this.listen( | ||
@@ -96,3 +96,11 @@ handle(x, onValue, 'write', this), | ||
export const coerce = value => { | ||
if (!(value instanceof ResultType)) return wrap(value) | ||
if (!(value instanceof ResultType)) { | ||
if (value instanceof Promise) { | ||
const result = pending() | ||
value.then(value => result.write(value), | ||
error => result.error(error)) | ||
return result | ||
} | ||
return wrap(value) | ||
} | ||
if (value instanceof Result) return value | ||
@@ -103,6 +111,5 @@ switch (value.state) { | ||
} | ||
var result = pending() | ||
value.listen( | ||
value => result.write(value), | ||
error => result.error(error)) | ||
const result = pending() | ||
value.listen(value => result.write(value), | ||
error => result.error(error)) | ||
return result | ||
@@ -156,3 +163,3 @@ } | ||
default: | ||
var x = pending() | ||
const x = pending() | ||
value.listen(handle(x, onValue, 'write'), | ||
@@ -159,0 +166,0 @@ handle(x, onError, 'error')) |
{ | ||
"name": "result", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "reify your results", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12373
254