matchWithNumberOtherwise
matchWithNumberOtherwise() handles selected values of a Clean number primitive. Raw number values form the matcher keys. Missing cases are sent to otherwise, which receives the original primitive narrowed to the remaining values.
Interactive example
Syntax
Classic signature
typescript
function matchWithNumberOtherwise<Input extends Primitive<number>, Matcher, Output>(
input: Input,
matcher: Matcher,
otherwise: (value: UnhandledPrimitive) => Output
): MatcherResult | OutputCurried signature
typescript
function matchWithNumberOtherwise<Input extends Primitive<number>, Matcher, Output>(
matcher: Matcher,
otherwise: (value: UnhandledPrimitive) => Output
): (input: Input) => MatcherResult | OutputParameters
input: a Clean number primitive with literal values.matcher: a partial object indexed by raw values from the primitive. Unknown keys are rejected.otherwise: receives the originalPrimitive,ConstrainedType, orNewType, narrowed to values without a handler.
Return value
The selected handler result, or the otherwise result for an unhandled wrapped value.
See also
matchWithNumber- Exhaustive primitive matching.matchWithStringOtherwise- String primitive equivalent.
