@visisoft/staticland
Advanced tools
Comparing version 0.1.11 to 0.1.12
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.11 visisoft.de | ||
(Build date: 1/11/2021 - 10:05:39 PM) | ||
@visisoft/staticland v.0.1.12 visisoft.de | ||
(Build date: 1/12/2021 - 8:41:02 PM) | ||
*/ | ||
@@ -27,4 +27,10 @@ 'use strict'; | ||
// :: (…b -> a) -> …b -> Either c a | ||
fromThrowable = f => semmelRamda.tryCatch(semmelRamda.o(of, f), left), | ||
// :: (a -> Boolean) -> (a -> b) -> a -> Either b a | ||
fromAssertedValue = semmelRamda.curry((predicate, createLeftValue, a) => | ||
predicate(a) ? of (a) : left(createLeftValue(a)) | ||
), | ||
// Inspection // | ||
@@ -53,4 +59,16 @@ | ||
// :: (c -> b) -> (a -> b) -> Either c a -> b | ||
either = semmelRamda.curry((leftFn, rightFn, ma) => | ||
isLeft(ma) ? leftFn(ma[0]) : rightFn(ma[1]) | ||
), | ||
// Combination // | ||
/** | ||
* From crocks.dev: Providing a means for a fallback or alternative value. | ||
* Combines two Either instances and will return the first Right it encounters or the last Left if it does not encounter a Right. | ||
*/ | ||
// :: Either b a -> Either b a -> Either b a | ||
alt = semmelRamda.curry((ma, mb) => | ||
either(semmelRamda.always(mb), of, ma) | ||
); | ||
@@ -60,4 +78,6 @@ | ||
exports.alt = alt; | ||
exports.chain = chain; | ||
exports.either = either; | ||
exports.fromAssertedValue = fromAssertedValue; | ||
exports.fromThrowable = fromThrowable; | ||
@@ -64,0 +84,0 @@ exports.isLeft = isLeft; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.11 visisoft.de | ||
(Build date: 1/11/2021 - 10:05:39 PM) | ||
@visisoft/staticland v.0.1.12 visisoft.de | ||
(Build date: 1/12/2021 - 8:41:02 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.11 visisoft.de | ||
(Build date: 1/11/2021 - 10:05:39 PM) | ||
@visisoft/staticland v.0.1.12 visisoft.de | ||
(Build date: 1/12/2021 - 8:41:02 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.11 visisoft.de | ||
(Build date: 1/11/2021 - 10:05:39 PM) | ||
@visisoft/staticland v.0.1.12 visisoft.de | ||
(Build date: 1/12/2021 - 8:41:02 PM) | ||
*/ | ||
@@ -396,4 +396,10 @@ 'use strict'; | ||
// :: (…b -> a) -> …b -> Either c a | ||
fromThrowable = f => semmelRamda.tryCatch(semmelRamda.o(of$2, f), left), | ||
// :: (a -> Boolean) -> (a -> b) -> a -> Either b a | ||
fromAssertedValue = semmelRamda.curry((predicate, createLeftValue, a) => | ||
predicate(a) ? of$2 (a) : left(createLeftValue(a)) | ||
), | ||
// Inspection // | ||
@@ -422,4 +428,16 @@ | ||
// :: (c -> b) -> (a -> b) -> Either c a -> b | ||
either = semmelRamda.curry((leftFn, rightFn, ma) => | ||
isLeft(ma) ? leftFn(ma[0]) : rightFn(ma[1]) | ||
), | ||
// Combination // | ||
/** | ||
* From crocks.dev: Providing a means for a fallback or alternative value. | ||
* Combines two Either instances and will return the first Right it encounters or the last Left if it does not encounter a Right. | ||
*/ | ||
// :: Either b a -> Either b a -> Either b a | ||
alt = semmelRamda.curry((ma, mb) => | ||
either(semmelRamda.always(mb), of$2, ma) | ||
); | ||
@@ -431,4 +449,6 @@ | ||
__proto__: null, | ||
alt: alt, | ||
chain: chain$2, | ||
either: either, | ||
fromAssertedValue: fromAssertedValue, | ||
fromThrowable: fromThrowable, | ||
@@ -435,0 +455,0 @@ isLeft: isLeft, |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.11 visisoft.de | ||
(Build date: 1/11/2021 - 10:05:39 PM) | ||
@visisoft/staticland v.0.1.12 visisoft.de | ||
(Build date: 1/12/2021 - 8:41:02 PM) | ||
*/ | ||
@@ -27,2 +27,7 @@ 'use strict'; | ||
// :: (a -> Boolean) -> (a -> b) -> a -> Either b a | ||
fromAssertedValue = semmelRamda.curry((predicate, createLeftValue, a) => | ||
predicate(a) ? of (a) : left(createLeftValue(a)) | ||
), | ||
// Inspection // | ||
@@ -48,4 +53,16 @@ | ||
// :: (c -> b) -> (a -> b) -> Either c a -> b | ||
either = semmelRamda.curry((leftFn, rightFn, ma) => | ||
isLeft(ma) ? leftFn(ma[0]) : rightFn(ma[1]) | ||
), | ||
// Combination // | ||
/** | ||
* From crocks.dev: Providing a means for a fallback or alternative value. | ||
* Combines two Either instances and will return the first Right it encounters or the last Left if it does not encounter a Right. | ||
*/ | ||
// :: Either b a -> Either b a -> Either b a | ||
alt = semmelRamda.curry((ma, mb) => | ||
either(semmelRamda.always(mb), of, ma) | ||
); | ||
@@ -52,0 +69,0 @@ |
@@ -70,3 +70,3 @@ { | ||
"type": "module", | ||
"version": "0.1.11" | ||
"version": "0.1.12" | ||
} |
@@ -8,3 +8,3 @@ /** | ||
import { compose, curry, either as eitherThisOr, nth, o, tryCatch, unary, when } from 'semmel-ramda'; | ||
import { always, compose, curry, either as eitherThisOr, nth, o, tryCatch, unary, when } from 'semmel-ramda'; | ||
@@ -20,4 +20,10 @@ const | ||
// :: (…b -> a) -> …b -> Either c a | ||
fromThrowable = f => tryCatch(o(of, f), left), | ||
// :: (a -> Boolean) -> (a -> b) -> a -> Either b a | ||
fromAssertedValue = curry((predicate, createLeftValue, a) => | ||
predicate(a) ? of (a) : left(createLeftValue(a)) | ||
), | ||
// Inspection // | ||
@@ -46,4 +52,16 @@ | ||
// :: (c -> b) -> (a -> b) -> Either c a -> b | ||
either = curry((leftFn, rightFn, ma) => | ||
isLeft(ma) ? leftFn(ma[0]) : rightFn(ma[1]) | ||
), | ||
// Combination // | ||
/** | ||
* From crocks.dev: Providing a means for a fallback or alternative value. | ||
* Combines two Either instances and will return the first Right it encounters or the last Left if it does not encounter a Right. | ||
*/ | ||
// :: Either b a -> Either b a -> Either b a | ||
alt = curry((ma, mb) => | ||
either(always(mb), of, ma) | ||
); | ||
@@ -53,5 +71,5 @@ | ||
export { | ||
chain, either, fromThrowable, isLeft, isRight, join, left, map, of | ||
alt, chain, either, fromAssertedValue, fromThrowable, isLeft, isRight, join, left, map, of | ||
}; | ||
export let right = of; | ||
export let right = of; |
74692
1571