MCPcopy Index your code
hub / github.com/Effect-TS/effect / clamp

Function clamp

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

Source from the content-addressed store, hash-verified

332 * @since 2.0.0
333 */
334export const clamp = <A>(O: Order<A>): {
335 (options: {
336 minimum: A
337 maximum: A
338 }): (self: A) => A
339 (self: A, options: {
340 minimum: A
341 maximum: A
342 }): A
343} =>
344 dual(
345 2,
346 (self: A, options: {
347 minimum: A
348 maximum: A
349 }): A => min(O)(options.maximum, max(O)(options.minimum, self))
350 )
351
352/**
353 * Test whether a value is between a minimum and a maximum (inclusive).

Callers 1

Order.test.tsFile · 0.50

Calls 2

minFunction · 0.70
maxFunction · 0.70

Tested by

no test coverage detected