@visisoft/staticland
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -82,2 +82,4 @@ 'use strict'; | ||
}), | ||
// Transformation // | ||
@@ -107,2 +109,8 @@ // map :: (a -> b) -> Promise e a -> Promise e b | ||
})), | ||
// It's essentially Promise.then and named coalesce in crocks Async | ||
// coalesce :: (e -> b) -> (a -> b) -> Promise e a -> Promise e b | ||
coalesce = semmelRamda.curry((left, right, p) => | ||
p.then(right, left) | ||
), | ||
@@ -141,14 +149,15 @@ // In this implementation an exception in the side-effect rubs off to the Promise | ||
var promise = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
of: of, | ||
ap: ap, | ||
bimap: bimap, | ||
chain: chain, | ||
create: create, | ||
map: map, | ||
mapRej: mapRej, | ||
reject: reject, | ||
tap: tap, | ||
tapRegardless: tapRegardless, | ||
join: join | ||
__proto__: null, | ||
of: of, | ||
ap: ap, | ||
bimap: bimap, | ||
chain: chain, | ||
coalesce: coalesce, | ||
create: create, | ||
map: map, | ||
mapRej: mapRej, | ||
reject: reject, | ||
tap: tap, | ||
tapRegardless: tapRegardless, | ||
join: join | ||
}); | ||
@@ -293,21 +302,21 @@ | ||
var maybe$1 = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
equals: equals, | ||
fromNilable: fromNilable, | ||
fromContentHolding: fromContentHolding, | ||
of: of$1, | ||
nothing: nothing, | ||
isJust: isJust, | ||
isNothing: isNothing, | ||
join: join$1, | ||
lift: lift, | ||
map: map$1, | ||
maybe: maybe, | ||
chain: chain$1, | ||
ap: ap$1, | ||
reduce: reduce, | ||
tap: tap$1, | ||
getOrElse: getOrElse, | ||
typeString: typeString, | ||
just: just | ||
__proto__: null, | ||
equals: equals, | ||
fromNilable: fromNilable, | ||
fromContentHolding: fromContentHolding, | ||
of: of$1, | ||
nothing: nothing, | ||
isJust: isJust, | ||
isNothing: isNothing, | ||
join: join$1, | ||
lift: lift, | ||
map: map$1, | ||
maybe: maybe, | ||
chain: chain$1, | ||
ap: ap$1, | ||
reduce: reduce, | ||
tap: tap$1, | ||
getOrElse: getOrElse, | ||
typeString: typeString, | ||
just: just | ||
}); | ||
@@ -358,12 +367,12 @@ | ||
var either$1 = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
chain: chain$2, | ||
either: either, | ||
fromThrowable: fromThrowable, | ||
isLeft: isLeft, | ||
isRight: isRight, | ||
left: left, | ||
map: map$2, | ||
of: of$2, | ||
right: right | ||
__proto__: null, | ||
chain: chain$2, | ||
either: either, | ||
fromThrowable: fromThrowable, | ||
isLeft: isLeft, | ||
isRight: isRight, | ||
left: left, | ||
map: map$2, | ||
of: of$2, | ||
right: right | ||
}); | ||
@@ -379,3 +388,3 @@ | ||
const | ||
// eitherToPromise :: Promise e Either c a -> Promise (c|e) a | ||
// eitherToPromise :: Either e a -> Promise e a | ||
eitherToPromise = either(reject, of), | ||
@@ -391,10 +400,17 @@ | ||
// maybeOfPromiseToPromiseOfMaybe :: Maybe Promise e a -> Promise e Maybe a | ||
maybeOfPromiseToPromiseOfMaybe = maybe(semmelRamda.compose(of, nothing), map(of$1)); | ||
maybeOfPromiseToPromiseOfMaybe = maybe(semmelRamda.compose(of, nothing), map(of$1)), | ||
// keyPromiseToPromiseCollection :: String -> {ki: Promise e vi, k:v …} -> Promise e {ki:vi, k:v …} | ||
// keyPromiseToPromiseCollection :: Int -> [v,…, Promise e v, v,…] -> Promise e [v] | ||
keyPromiseToPromiseCollection = semmelRamda.curry((key, obj) => | ||
map(semmelRamda.assoc(key, semmelRamda.__, obj), obj[key]) | ||
); | ||
var transformations = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
eitherToPromise: eitherToPromise, | ||
maybeToPromise: maybeToPromise, | ||
maybeToObj: maybeToObj, | ||
maybeOfPromiseToPromiseOfMaybe: maybeOfPromiseToPromiseOfMaybe | ||
__proto__: null, | ||
eitherToPromise: eitherToPromise, | ||
maybeToPromise: maybeToPromise, | ||
maybeToObj: maybeToObj, | ||
maybeOfPromiseToPromiseOfMaybe: maybeOfPromiseToPromiseOfMaybe, | ||
keyPromiseToPromiseCollection: keyPromiseToPromiseCollection | ||
}); | ||
@@ -401,0 +417,0 @@ |
@@ -57,3 +57,3 @@ { | ||
"type": "module", | ||
"version": "0.1.4" | ||
"version": "0.1.5" | ||
} |
@@ -78,2 +78,4 @@ /** | ||
}), | ||
// Transformation // | ||
@@ -104,2 +106,8 @@ // map :: (a -> b) -> Promise e a -> Promise e b | ||
})), | ||
// It's essentially Promise.then and named coalesce in crocks Async | ||
// coalesce :: (e -> b) -> (a -> b) -> Promise e a -> Promise e b | ||
coalesce = curry((left, right, p) => | ||
p.then(right, left) | ||
), | ||
@@ -136,5 +144,5 @@ // In this implementation an exception in the side-effect rubs off to the Promise | ||
export { | ||
of, ap, bimap, chain, create, map, mapRej, reject, tap, tapRegardless | ||
of, ap, bimap, chain, coalesce, create, map, mapRej, reject, tap, tapRegardless | ||
}; | ||
export let join = identity; |
@@ -11,6 +11,6 @@ /** | ||
import { maybe, nothing, of as of_mb } from './maybe.js'; | ||
import { always, compose, curry, objOf, thunkify } from 'semmel-ramda'; | ||
import { __, always, assoc, compose, curry, objOf, thunkify } from 'semmel-ramda'; | ||
const | ||
// eitherToPromise :: Promise e Either c a -> Promise (c|e) a | ||
// eitherToPromise :: Either e a -> Promise e a | ||
eitherToPromise = either(reject, of_p), | ||
@@ -26,3 +26,9 @@ | ||
// maybeOfPromiseToPromiseOfMaybe :: Maybe Promise e a -> Promise e Maybe a | ||
maybeOfPromiseToPromiseOfMaybe = maybe(compose(of_p, nothing), map_p(of_mb)); | ||
maybeOfPromiseToPromiseOfMaybe = maybe(compose(of_p, nothing), map_p(of_mb)), | ||
// keyPromiseToPromiseCollection :: String -> {ki: Promise e vi, k:v …} -> Promise e {ki:vi, k:v …} | ||
// keyPromiseToPromiseCollection :: Int -> [v,…, Promise e v, v,…] -> Promise e [v] | ||
keyPromiseToPromiseCollection = curry((key, obj) => | ||
map_p(assoc(key, __, obj), obj[key]) | ||
); | ||
@@ -33,3 +39,4 @@ export { | ||
maybeToObj, | ||
maybeOfPromiseToPromiseOfMaybe | ||
maybeOfPromiseToPromiseOfMaybe, | ||
keyPromiseToPromiseCollection | ||
}; |
40983
663