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

Function parseSegment

repos/effect/packages/effect/src/Cron.ts:1126–1194  ·  view source on GitHub ↗
(
  input: string,
  options: SegmentOptions
)

Source from the content-addressed store, hash-verified

1124 * hours: [9],
1125 * days: [1, 15],
1126 * months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
1127 * weekdays: [1, 2, 3, 4, 5]
1128 * })
1129 *
1130 * const cron2 = Cron.make({
1131 * minutes: [0],
1132 * hours: [9],
1133 * days: [1, 15],
1134 * months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
1135 * weekdays: [1, 2, 3, 4, 5]
1136 * })
1137 *
1138 * Cron.equals(cron1, cron2) // => true
1139 * Cron.equals(cron1)(cron2) // => true
1140 * ```
1141 *
1142 * @see {@link Equivalence} for the reusable equivalence instance
1143 *
1144 * @category predicates
1145 * @since 2.0.0
1146 */
1147export const equals: {
1148 (that: Cron): (self: Cron) => boolean
1149 (self: Cron, that: Cron): boolean
1150} = dual(2, (self: Cron, that: Cron): boolean => Equivalence(self, that))
1151
1152interface SegmentOptions {
1153 min: number
1154 max: number
1155 aliases?: Record<string, number> | undefined
1156 normalize?: ((value: number) => number) | undefined
1157}
1158
1159interface ParsedSegment {
1160 readonly values: Set<number>
1161 readonly wildcard: boolean
1162}
1163
1164const secondOptions: SegmentOptions = {
1165 min: 0,
1166 max: 59
1167}
1168
1169const minuteOptions: SegmentOptions = {
1170 min: 0,
1171 max: 59
1172}
1173
1174const hourOptions: SegmentOptions = {
1175 min: 0,
1176 max: 23
1177}
1178
1179const dayOptions: SegmentOptions = {
1180 min: 1,
1181 max: 31
1182}
1183

Callers 1

parseFunction · 0.85

Calls 6

splitStepFunction · 0.85
splitRangeFunction · 0.85
splitMethod · 0.65
addMethod · 0.65
succeedMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…