@visisoft/staticland
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -94,2 +94,14 @@ 'use strict'; | ||
/** | ||
* shameless copy from Fluture | ||
*/ | ||
chainRej_ = semmelRamda.curry((fn, aPromise) => aPromise.then(null, fn)), | ||
// this implementation enforces fn to return a promise | ||
// chainRej :: (e -> Promise g a) -> Promise e a -> Promise g b | ||
chainRej = semmelRamda.curry((fn, aPromise) => | ||
new Promise((resolve, reject_) => { | ||
aPromise.then(resolve, a => fn(a).then(resolve, reject_)); | ||
}) | ||
), | ||
// bimap :: Bifunctor m => (a -> c) -> (b -> d) -> m a b -> m c d | ||
@@ -102,3 +114,3 @@ bimap = semmelRamda.curry((failureMap, successMap, aPromise) => | ||
chain = semmelRamda.curry((fn, aPromise) => | ||
new Promise((resolve, reject) => { | ||
new Promise((resolve, reject_) => { | ||
aPromise | ||
@@ -108,3 +120,3 @@ .then(a => | ||
) | ||
.catch(reject); | ||
.catch(reject_); | ||
})), | ||
@@ -155,2 +167,3 @@ | ||
chain: chain, | ||
chainRej: chainRej, | ||
coalesce: coalesce, | ||
@@ -157,0 +170,0 @@ create: create, |
@@ -57,3 +57,3 @@ { | ||
"type": "module", | ||
"version": "0.1.5" | ||
"version": "0.1.6" | ||
} |
@@ -90,2 +90,14 @@ /** | ||
/** | ||
* shameless copy from Fluture | ||
*/ | ||
chainRej_ = curry((fn, aPromise) => aPromise.then(null, fn)), | ||
// this implementation enforces fn to return a promise | ||
// chainRej :: (e -> Promise g a) -> Promise e a -> Promise g b | ||
chainRej = curry((fn, aPromise) => | ||
new Promise((resolve, reject_) => { | ||
aPromise.then(resolve, a => fn(a).then(resolve, reject_)); | ||
}) | ||
), | ||
// bimap :: Bifunctor m => (a -> c) -> (b -> d) -> m a b -> m c d | ||
@@ -99,3 +111,3 @@ bimap = curry((failureMap, successMap, aPromise) => | ||
chain = curry((fn, aPromise) => | ||
new Promise((resolve, reject) => { | ||
new Promise((resolve, reject_) => { | ||
aPromise | ||
@@ -105,3 +117,3 @@ .then(a => | ||
) | ||
.catch(reject); | ||
.catch(reject_); | ||
})), | ||
@@ -145,5 +157,5 @@ | ||
export { | ||
of, ap, bimap, chain, coalesce, create, map, mapRej, reject, tap, tapRegardless | ||
of, ap, bimap, chain, chainRej, coalesce, create, map, mapRej, reject, tap, tapRegardless | ||
}; | ||
export let join = identity; |
41788
686