nxtcron - v1.0.1
    Preparing search index...

    Class CronParser

    Parses and validates cron expressions into structured objects.

    Index

    Constructors

    Properties

    instance?: CronParser
    SPLIT: RegExp = ...

    Methods

    • Expand a special alias into its 5-field equivalent.

      Parameters

      • expr: string

      Returns string

    • Parse a cron expression into a fully validated internal representation.

      The returned object contains the parsed field definitions together with pre-computed value sets for efficient schedule evaluation.

      Parameters

      • expr: string

        A standard 5-field cron string or special alias.

      Returns ParsedCronExpression

      A fully parsed cron expression.

      Error if the expression is malformed or contains invalid values.

      const parsed = parser.parse( '* 9-17 * JAN,MAR MON-FRI' );
      
    • Expand a named alias (e.g. JAN) to its numeric value for the given field.

      Parameters

      Returns string | number

    • Split a cron expression string into its five field tokens.

      Parameters

      • expr: string

      Returns CronTuple

    • Convert a cron expression into a structured CronObject.

      Parameters

      • expr: string

        A standard 5-field cron string or special alias.

      Returns CronObject

      A CronObject containing the raw field values.

      Error if the expression is malformed.

      parser.toObject( '0 9 * * MON' );
      
    • Convert a cron expression into a ordered CronTuple.

      Parameters

      • expr: string

        A standard 5-field cron string or special alias.

      Returns CronTuple

      A CronTuple with ordered cron fields

      Error if the expression is malformed.

      parser.toTuple( '0 1 * * SAT,SUN' );
      
    • Validate a cron expression without throwing.

      Parameters

      • expr: string

        The cron expression to validate.

      Returns boolean

      true if valid, false otherwise.

      parser.validate( '0 9 * * MON' );  // true
      parser.validate( '99 * * * *' ); // false