MCPcopy Create free account
hub / github.com/Effect-TS/effect / clamp

Function clamp

packages/effect/src/Order.ts:873–889  ·  view source on GitHub ↗
(O: Order<A>)

Source from the content-addressed store, hash-verified

871 * @since 2.0.0
872 */
873export const clamp = <A>(O: Order<A>): {
874 (options: {
875 minimum: A
876 maximum: A
877 }): (self: A) => A
878 (self: A, options: {
879 minimum: A
880 maximum: A
881 }): A
882} =>
883 dual(
884 2,
885 (self: A, options: {
886 minimum: A
887 maximum: A
888 }): A => min(O)(options.maximum, max(O)(options.minimum, self))
889 )
890
891/**
892 * Checks whether a value is between a minimum and a maximum (inclusive) according to the given order.

Callers 1

Order.test.tsFile · 0.50

Calls 2

minFunction · 0.70
maxFunction · 0.70

Tested by

no test coverage detected