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

Function minuteOfHour

packages/effect/src/internal/schedule.ts:1070–1095  ·  view source on GitHub ↗
(minute: number)

Source from the content-addressed store, hash-verified

1068
1069/** @internal */
1070export const minuteOfHour = (minute: number): Schedule.Schedule<number> =>
1071 makeWithState<[number, number], unknown, number>(
1072 [Number.MIN_SAFE_INTEGER, 0],
1073 (now, _, state) => {
1074 if (!Number.isInteger(minute) || minute < 0 || 59 < minute) {
1075 return core.dieSync(() =>
1076 new core.IllegalArgumentException(
1077 `Invalid argument in: minuteOfHour(${minute}). Must be in range 0...59`
1078 )
1079 )
1080 }
1081 const n = state[1]
1082 const initial = n === 0
1083 const minute0 = nextMinute(now, minute, initial)
1084 const start = beginningOfMinute(minute0)
1085 const end = endOfMinute(minute0)
1086 const interval = Interval.make(start, end)
1087 return core.succeed(
1088 [
1089 [end, n + 1],
1090 n,
1091 ScheduleDecision.continueWith(interval)
1092 ]
1093 )
1094 }
1095 )
1096
1097/** @internal */
1098export const modifyDelay = dual<

Callers

nothing calls this directly

Calls 5

makeWithStateFunction · 0.85
nextMinuteFunction · 0.85
beginningOfMinuteFunction · 0.85
endOfMinuteFunction · 0.85
makeMethod · 0.65

Tested by

no test coverage detected