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

Function minuteOfHour

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

Source from the content-addressed store, hash-verified

1060
1061/** @internal */
1062export const minuteOfHour = (minute: number): Schedule.Schedule<number> =>
1063 makeWithState<[number, number], unknown, number>(
1064 [Number.MIN_SAFE_INTEGER, 0],
1065 (now, _, state) => {
1066 if (!Number.isInteger(minute) || minute < 0 || 59 < minute) {
1067 return core.dieSync(() =>
1068 new core.IllegalArgumentException(
1069 `Invalid argument in: minuteOfHour(${minute}). Must be in range 0...59`
1070 )
1071 )
1072 }
1073 const n = state[1]
1074 const initial = n === 0
1075 const minute0 = nextMinute(now, minute, initial)
1076 const start = beginningOfMinute(minute0)
1077 const end = endOfMinute(minute0)
1078 const interval = Interval.make(start, end)
1079 return core.succeed(
1080 [
1081 [end, n + 1],
1082 n,
1083 ScheduleDecision.continueWith(interval)
1084 ]
1085 )
1086 }
1087 )
1088
1089/** @internal */
1090export 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…