@visisoft/staticland
Advanced tools
Comparing version 0.1.22 to 0.1.23
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
@visisoft/staticland v.0.1.23 visisoft.de | ||
(Build date: 10/4/2021 - 8:13:00 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
@visisoft/staticland v.0.1.23 visisoft.de | ||
(Build date: 10/4/2021 - 8:13:00 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
@visisoft/staticland v.0.1.23 visisoft.de | ||
(Build date: 10/4/2021 - 8:13:00 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
@visisoft/staticland v.0.1.23 visisoft.de | ||
(Build date: 10/4/2021 - 8:13:00 PM) | ||
*/ | ||
@@ -5,0 +5,0 @@ 'use strict'; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
@visisoft/staticland v.0.1.23 visisoft.de | ||
(Build date: 10/4/2021 - 8:13:00 PM) | ||
*/ | ||
@@ -15,2 +15,52 @@ 'use strict'; | ||
/** | ||
* StaticLand: tap.js | ||
* | ||
* Created by Matthias Seemann on 4.10.2021. | ||
* Copyright (c) 2021 Visisoft OHG. All rights reserved. | ||
*/ | ||
const | ||
// In this implementation an exception in the side-effect rubs off to the Promise | ||
// tap :: (a -> *) -> Promise a -> Promise a | ||
tap = semmelRamda.curry((fn, p) => | ||
p.then(x => { | ||
fn(x); | ||
return x; | ||
})), | ||
bi_tap = semmelRamda.curry((onFailure, onSuccess, p) => | ||
p.then( | ||
x => { | ||
onSuccess(x); | ||
return x; | ||
}, | ||
e => { | ||
onFailure(e); | ||
return Promise.reject(e); | ||
} | ||
) | ||
), | ||
/** | ||
* Execute a synchronous side effect. | ||
* In this implementation an exception in the side-effect is ignored. | ||
* <pre> | ||
* promise X ---------> X ---> | ||
* \ | ||
* - fn(X) -> Y | ||
* </pre> | ||
* | ||
* @aka forEach | ||
* @template A | ||
* @param {function(A):*} sideEffect | ||
* @return {function(Promise<A>): Promise<A>} | ||
*/ | ||
// tapRegardless :: (a -> *) -> Promise a -> Promise a | ||
tapRegardless = semmelRamda.curry((fn, p) => { | ||
p.then(fn).catch(x => x); | ||
return p; | ||
}); | ||
/** | ||
* StaticLand: ap.js | ||
@@ -136,31 +186,2 @@ * | ||
), | ||
// In this implementation an exception in the side-effect rubs off to the Promise | ||
// tap :: (a -> *) -> Promise a -> Promise a | ||
tap = semmelRamda.curry((fn, p) => | ||
p.then(x => { | ||
fn(x); | ||
return x; | ||
})), | ||
/** | ||
* Execute a synchronous side effect. | ||
* In this implementation an exception in the side-effect is ignored. | ||
* <pre> | ||
* promise X ---------> X ---> | ||
* \ | ||
* - fn(X) -> Y | ||
* </pre> | ||
* | ||
* @aka forEach | ||
* @template A | ||
* @param {function(A):*} sideEffect | ||
* @return {function(Promise<A>): Promise<A>} | ||
*/ | ||
// tapRegardless :: (a -> *) -> Promise a -> Promise a | ||
tapRegardless = semmelRamda.curry((fn, p) => { | ||
p.then(fn).catch(x => x); | ||
return p; | ||
}), | ||
@@ -279,2 +300,3 @@ /** | ||
exports.ap = ap_p; | ||
exports.bi_tap = bi_tap; | ||
exports.bimap = bimap; | ||
@@ -281,0 +303,0 @@ exports.chain = chain; |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
@visisoft/staticland v.0.1.23 visisoft.de | ||
(Build date: 10/4/2021 - 8:13:00 PM) | ||
*/ | ||
@@ -16,2 +16,52 @@ 'use strict'; | ||
/** | ||
* StaticLand: tap.js | ||
* | ||
* Created by Matthias Seemann on 4.10.2021. | ||
* Copyright (c) 2021 Visisoft OHG. All rights reserved. | ||
*/ | ||
const | ||
// In this implementation an exception in the side-effect rubs off to the Promise | ||
// tap :: (a -> *) -> Promise a -> Promise a | ||
tap = semmelRamda.curry((fn, p) => | ||
p.then(x => { | ||
fn(x); | ||
return x; | ||
})), | ||
bi_tap = semmelRamda.curry((onFailure, onSuccess, p) => | ||
p.then( | ||
x => { | ||
onSuccess(x); | ||
return x; | ||
}, | ||
e => { | ||
onFailure(e); | ||
return Promise.reject(e); | ||
} | ||
) | ||
), | ||
/** | ||
* Execute a synchronous side effect. | ||
* In this implementation an exception in the side-effect is ignored. | ||
* <pre> | ||
* promise X ---------> X ---> | ||
* \ | ||
* - fn(X) -> Y | ||
* </pre> | ||
* | ||
* @aka forEach | ||
* @template A | ||
* @param {function(A):*} sideEffect | ||
* @return {function(Promise<A>): Promise<A>} | ||
*/ | ||
// tapRegardless :: (a -> *) -> Promise a -> Promise a | ||
tapRegardless = semmelRamda.curry((fn, p) => { | ||
p.then(fn).catch(x => x); | ||
return p; | ||
}); | ||
/** | ||
* StaticLand: ap.js | ||
@@ -137,31 +187,2 @@ * | ||
), | ||
// In this implementation an exception in the side-effect rubs off to the Promise | ||
// tap :: (a -> *) -> Promise a -> Promise a | ||
tap = semmelRamda.curry((fn, p) => | ||
p.then(x => { | ||
fn(x); | ||
return x; | ||
})), | ||
/** | ||
* Execute a synchronous side effect. | ||
* In this implementation an exception in the side-effect is ignored. | ||
* <pre> | ||
* promise X ---------> X ---> | ||
* \ | ||
* - fn(X) -> Y | ||
* </pre> | ||
* | ||
* @aka forEach | ||
* @template A | ||
* @param {function(A):*} sideEffect | ||
* @return {function(Promise<A>): Promise<A>} | ||
*/ | ||
// tapRegardless :: (a -> *) -> Promise a -> Promise a | ||
tapRegardless = semmelRamda.curry((fn, p) => { | ||
p.then(fn).catch(x => x); | ||
return p; | ||
}), | ||
@@ -283,2 +304,3 @@ /** | ||
bimap: bimap, | ||
bi_tap: bi_tap, | ||
chain: chain, | ||
@@ -285,0 +307,0 @@ chainIf: chainIf, |
/* @license Apache-2.0 | ||
@visisoft/staticland v.0.1.22 visisoft.de | ||
(Build date: 8/28/2021 - 8:19:03 PM) | ||
@visisoft/staticland v.0.1.23 visisoft.de | ||
(Build date: 10/4/2021 - 8:13:00 PM) | ||
*/ | ||
@@ -78,2 +78,52 @@ 'use strict'; | ||
/** | ||
* StaticLand: tap.js | ||
* | ||
* Created by Matthias Seemann on 4.10.2021. | ||
* Copyright (c) 2021 Visisoft OHG. All rights reserved. | ||
*/ | ||
const | ||
// In this implementation an exception in the side-effect rubs off to the Promise | ||
// tap :: (a -> *) -> Promise a -> Promise a | ||
tap = semmelRamda.curry((fn, p) => | ||
p.then(x => { | ||
fn(x); | ||
return x; | ||
})), | ||
bi_tap = semmelRamda.curry((onFailure, onSuccess, p) => | ||
p.then( | ||
x => { | ||
onSuccess(x); | ||
return x; | ||
}, | ||
e => { | ||
onFailure(e); | ||
return Promise.reject(e); | ||
} | ||
) | ||
), | ||
/** | ||
* Execute a synchronous side effect. | ||
* In this implementation an exception in the side-effect is ignored. | ||
* <pre> | ||
* promise X ---------> X ---> | ||
* \ | ||
* - fn(X) -> Y | ||
* </pre> | ||
* | ||
* @aka forEach | ||
* @template A | ||
* @param {function(A):*} sideEffect | ||
* @return {function(Promise<A>): Promise<A>} | ||
*/ | ||
// tapRegardless :: (a -> *) -> Promise a -> Promise a | ||
tapRegardless = semmelRamda.curry((fn, p) => { | ||
p.then(fn).catch(x => x); | ||
return p; | ||
}); | ||
/** | ||
* StaticLand: ap.js | ||
@@ -192,31 +242,2 @@ * | ||
), | ||
// In this implementation an exception in the side-effect rubs off to the Promise | ||
// tap :: (a -> *) -> Promise a -> Promise a | ||
tap = semmelRamda.curry((fn, p) => | ||
p.then(x => { | ||
fn(x); | ||
return x; | ||
})), | ||
/** | ||
* Execute a synchronous side effect. | ||
* In this implementation an exception in the side-effect is ignored. | ||
* <pre> | ||
* promise X ---------> X ---> | ||
* \ | ||
* - fn(X) -> Y | ||
* </pre> | ||
* | ||
* @aka forEach | ||
* @template A | ||
* @param {function(A):*} sideEffect | ||
* @return {function(Promise<A>): Promise<A>} | ||
*/ | ||
// tapRegardless :: (a -> *) -> Promise a -> Promise a | ||
tapRegardless = semmelRamda.curry((fn, p) => { | ||
p.then(fn).catch(x => x); | ||
return p; | ||
}), | ||
@@ -223,0 +244,0 @@ /** |
@@ -94,3 +94,3 @@ { | ||
"type": "module", | ||
"version": "0.1.22" | ||
"version": "0.1.23" | ||
} |
@@ -5,2 +5,5 @@ import {BinaryCurriedFn} from './common'; | ||
export function bi_tap<T>(onFailure: (e: any) => void, onSuccess: (x?: T) => any, p: Promise<T>): Promise<T>; | ||
export function bi_tap<T>(onFailure: (e: any) => void, onSuccess: (x?: T) => any): (p: Promise<T>) => Promise<T>; | ||
/** | ||
@@ -40,1 +43,4 @@ * Produce a Promise from the factory function and the resolution value of the promise | ||
export function tap<T>(fn: (x?: T) => any): (p: Promise<T>) => Promise<T>; | ||
export function tapRegardless<T>(fn: (x?: T) => any, p: Promise<T>): Promise<T>; | ||
export function tapRegardless<T>(fn: (x?: T) => any): (p: Promise<T>) => Promise<T>; |
@@ -5,2 +5,5 @@ import {BinaryCurriedFn} from './common'; | ||
export function bi_tap<T>(onFailure: (e: any) => void, onSuccess: (x?: T) => any, p: Promise<T>): Promise<T>; | ||
export function bi_tap<T>(onFailure: (e: any) => void, onSuccess: (x?: T) => any): (p: Promise<T>) => Promise<T>; | ||
/** | ||
@@ -40,1 +43,4 @@ * Produce a Promise from the factory function and the resolution value of the promise | ||
export function tap<T>(fn: (x?: T) => any): (p: Promise<T>) => Promise<T>; | ||
export function tapRegardless<T>(fn: (x?: T) => any, p: Promise<T>): Promise<T>; | ||
export function tapRegardless<T>(fn: (x?: T) => any): (p: Promise<T>) => Promise<T>; |
@@ -10,2 +10,3 @@ /** | ||
import map from './promise/map.js'; | ||
import {bi_tap, tap, tapRegardless} from "./promise/tap.js"; | ||
@@ -85,31 +86,2 @@ const | ||
), | ||
// In this implementation an exception in the side-effect rubs off to the Promise | ||
// tap :: (a -> *) -> Promise a -> Promise a | ||
tap = curry((fn, p) => | ||
p.then(x => { | ||
fn(x); | ||
return x; | ||
})), | ||
/** | ||
* Execute a synchronous side effect. | ||
* In this implementation an exception in the side-effect is ignored. | ||
* <pre> | ||
* promise X ---------> X ---> | ||
* \ | ||
* - fn(X) -> Y | ||
* </pre> | ||
* | ||
* @aka forEach | ||
* @template A | ||
* @param {function(A):*} sideEffect | ||
* @return {function(Promise<A>): Promise<A>} | ||
*/ | ||
// tapRegardless :: (a -> *) -> Promise a -> Promise a | ||
tapRegardless = curry((fn, p) => { | ||
p.then(fn).catch(x => x); | ||
return p; | ||
}), | ||
@@ -222,3 +194,3 @@ /** | ||
export { | ||
of, all, alt, bimap, chain, chainIf, chainTap, chainRej, coalesce, create, map, mapRej, | ||
of, all, alt, bimap, bi_tap, chain, chainIf, chainTap, chainRej, coalesce, create, map, mapRej, | ||
race, reject, tap, tapRegardless, empty | ||
@@ -225,0 +197,0 @@ }; |
123005
72
3147