@parischap/pretty-print
Version:
A functional library to pretty-print and treeify objects
15 lines • 788 B
JavaScript
/** This module implements a Type that represents an array of ByPasser's (see ByPasser.ts) */
import { MArray } from '@parischap/effect-lib';
import { Array, Function, pipe } from 'effect';
/**
* Returns a ByPasser that is equivalent to `self`. The returned ByPasser executes successively each
* ByPasser of `self` until it meets one that returns a `some`. If such a ByPasser exists, the
* corresponding `some` is returned. Otherwise, it returns a `none`.
*
* @category Destructors
*/
export const toSyntheticByPasser = self => function (constructors) {
const initializedByPassers = Array.map(self, byPasser => byPasser.call(this, constructors));
return value => pipe(initializedByPassers, MArray.firstSomeResult(Function.apply(value)));
};
//# sourceMappingURL=ByPassers.js.map