Hyperlinkv0.8.0-beta.28

Cron

Cron.isCronconsteffect/Cron.ts:245
(u: unknown): u is Cron

Checks whether a given value is a Cron instance.

When to use

Use to narrow an unknown value before treating it as a Cron schedule.

Details

This function is a type guard that determines whether the provided value is a valid Cron instance by checking for the presence of the Cron type identifier.

Example (Checking cron values)

import { Cron } from "effect"

const cron = Cron.make({
  minutes: [0],
  hours: [9],
  days: [1, 15],
  months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  weekdays: [1, 2, 3, 4, 5]
})

console.log(Cron.isCron(cron)) // true
console.log(Cron.isCron({})) // false
console.log(Cron.isCron("not a cron")) // false
guardsmakeparse
Source effect/Cron.ts:2451 lines
export const isCron = (u: unknown): u is Cron => hasProperty(u, TypeId)
Referenced by 1 symbols