keepAsRightSelection
Keeps selected Either informations on the Right side through an exhaustive selector.
The selector maps every possible information of the input union to true or false. A true entry keeps or converts the matching input to Right; a false entry keeps or converts it to Left.
Interactive example
Syntax
Classic signature
typescript
function keepAsRightSelection<
GenericInput extends unknown,
GenericSelector extends Record<Information, boolean>,
>(
input: GenericInput,
selector: GenericSelector,
): KeptAsRightOrLeftInputCurried signature
typescript
function keepAsRightSelection<
GenericInput extends unknown,
GenericSelector extends Record<Information, boolean>,
>(
selector: GenericSelector,
): (input: GenericInput) => KeptAsRightOrLeftInputParameters
selector: Exhaustive object where each possible input information is mapped totrueorfalse.input: Either value to normalize immediately, or later through the curried form.
Return value
Returns a Right when the current information is selected with true, converting a matching Left if needed. Returns a Left when the current information is selected with false, converting a matching Right if needed. Non-Either values are returned unchanged.
When a selector entry is typed as boolean, the return type includes both possible classifications for that information.
See also
keepAsRightByInformation– Selects informations from a string or string array.unwrapSelection– Unwraps selected payloads from an exhaustive selector.matchInformation– Exhaustive callback-based matching by information.
