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

Function match

packages/effect/src/Cron.ts:388–422  ·  view source on GitHub ↗
(cron: Cron, date: DateTime.DateTime.Input)

Source from the content-addressed store, hash-verified

386 * @since 2.0.0
387 */
388export const match = (cron: Cron, date: DateTime.DateTime.Input): boolean => {
389 const parts = dateTime.unsafeMakeZoned(date, {
390 timeZone: Option.getOrUndefined(cron.tz)
391 }).pipe(dateTime.toParts)
392
393 if (cron.seconds.size !== 0 && !cron.seconds.has(parts.seconds)) {
394 return false
395 }
396
397 if (cron.minutes.size !== 0 && !cron.minutes.has(parts.minutes)) {
398 return false
399 }
400
401 if (cron.hours.size !== 0 && !cron.hours.has(parts.hours)) {
402 return false
403 }
404
405 if (cron.months.size !== 0 && !cron.months.has(parts.month)) {
406 return false
407 }
408
409 if (cron.days.size === 0 && cron.weekdays.size === 0) {
410 return true
411 }
412
413 if (cron.weekdays.size === 0) {
414 return cron.days.has(parts.day)
415 }
416
417 if (cron.days.size === 0) {
418 return cron.weekdays.has(parts.weekDay)
419 }
420
421 return cron.days.has(parts.day) || cron.weekdays.has(parts.weekDay)
422}
423
424const daysInMonth = (date: Date): number =>
425 new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 0)).getUTCDate()

Callers 11

optionFunction · 0.70
eitherFunction · 0.70
toMillisFunction · 0.70
toSecondsFunction · 0.70
toMinutesFunction · 0.70
toHoursFunction · 0.70
toDaysFunction · 0.70
toWeeksFunction · 0.70
Duration.tsFile · 0.70
Either.tsFile · 0.70
Match.tst.tsFile · 0.50

Calls 1

pipeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…