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

Function clamp

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

Source from the content-addressed store, hash-verified

902 * @since 2.0.0
903 */
904export const clamp = <A>(O: Order<A>): {
905 (options: {
906 minimum: A
907 maximum: A
908 }): (self: A) => A
909 (self: A, options: {
910 minimum: A
911 maximum: A
912 }): A
913} =>
914 dual(
915 2,
916 (self: A, options: {
917 minimum: A
918 maximum: A
919 }): A => min(O)(max(O)(self, options.minimum), options.maximum)
920 )
921
922/**
923 * Checks whether a value is between a minimum and a maximum (inclusive) according to the given order.

Callers

nothing calls this directly

Calls 2

minFunction · 0.70
maxFunction · 0.70

Tested by

no test coverage detected