(that: Duration): (self: Duration) => Duration
(self: Duration, that: Duration): DurationReturns the smaller of two Durations.
Example (Selecting the shorter duration)
import { Duration } from "effect"
const shorter = Duration.min(Duration.seconds(5), Duration.seconds(3))
console.log(Duration.toSeconds(shorter)) // 3ordering
Source effect/Duration.ts:12354 lines
export const const min: {
(that: Duration): (self: Duration) => Duration
(self: Duration, that: Duration): Duration
}
Returns the smaller of two Durations.
Example (Selecting the shorter duration)
import { Duration } from "effect"
const shorter = Duration.min(Duration.seconds(5), Duration.seconds(3))
console.log(Duration.toSeconds(shorter)) // 3
min: {
(that: Duration(parameter) that: {
value: DurationValue;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
that: Duration): (self: Duration(parameter) self: {
value: DurationValue;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self: Duration) => Duration
(self: Duration(parameter) self: {
value: DurationValue;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
self: Duration, that: Duration(parameter) that: {
value: DurationValue;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
that: Duration): Duration
} = import orderorder.const min: <A>(O: Order<A>) => {
(that: A): (self: A) => A
(self: A, that: A): A
}
Returns the minimum of two values according to the given order. If they are equal, returns the first argument.
When to use
Use when you need to select the smaller of two values according to an
Order.
Details
Returns the value that compares as less than or equal to the other value. If
values are equal, the first argument is returned.
Example (Selecting the minimum value)
import { Order } from "effect"
const minNumber = Order.min(Order.Number)
console.log(minNumber(1, 2)) // 1
console.log(minNumber(2, 1)) // 1
console.log(minNumber(1, 1)) // 1
min(const Order: order.Order<Duration>Provides an Order instance for comparing Duration values.
Details
NegativeInfinity < any finite value < Infinity.
Example (Sorting durations)
import { Duration } from "effect"
const durations = [
Duration.seconds(3),
Duration.seconds(1),
Duration.seconds(2)
]
const sorted = durations.sort((a, b) => Duration.Order(a, b))
console.log(sorted.map(Duration.toSeconds)) // [1, 2, 3]
Order)