MCPcopy Create free account
hub / github.com/effect-app/libs / parse

Function parse

repos/effect/packages/effect/src/Cron.ts:565–592  ·  view source on GitHub ↗
(cron: string, tz?: DateTime.TimeZone | string)

Source from the content-addressed store, hash-verified

563 return Result.all({
564 tz: zone,
565 seconds: parseSegment(seconds, secondOptions),
566 minutes: parseSegment(minutes, minuteOptions),
567 hours: parseSegment(hours, hourOptions),
568 days: parseSegment(days, dayOptions),
569 months: parseSegment(months, monthOptions),
570 weekdays: parseSegment(weekdays, weekdayOptions)
571 }).pipe(Result.map(({ tz, seconds, minutes, hours, days, months, weekdays }) =>
572 make({
573 tz,
574 seconds: seconds.values,
575 minutes: minutes.values,
576 hours: hours.values,
577 days: days.values,
578 months: months.values,
579 weekdays: weekdays.values,
580 and: (days.wildcard || weekdays.wildcard) && days.values.size !== 0 && weekdays.values.size !== 0
581 })
582 ))
583}
584
585/**
586 * Parses a cron expression into a `Cron` instance, throwing on failure.
587 *
588 * **When to use**
589 *
590 * Use when you expect the input to be valid and want to avoid handling the
591 * `Result` type.
592 *
593 * **Example** (Parsing cron expressions unsafely)
594 *
595 * ```ts import.meta.vitest

Callers 4

parseUnsafeFunction · 0.70
makeFunction · 0.70
parseRuleFunction · 0.50
Option.test.tsFile · 0.50

Calls 7

parseSegmentFunction · 0.85
filterMethod · 0.80
splitMethod · 0.65
pipeMethod · 0.65
mapMethod · 0.65
failMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…