Options
All
  • Public
  • Public/Protected
  • All
Menu

A class which helps describe ScheduleInput if it matches a pattern.

Hierarchy

  • Pattern

Index

Constructors

constructor

  • Creates a new pattern.

    Parameters

    • name: string

      The unique name of the pattern.

    • listed: boolean

      If the pattern is "listed" Pattern.listed.

    • describe: DescribePattern

      A function to describe the pattern given a Day.

    • rules: PatternRules

      The rules which describe how to detect and apply the pattern to schedule input.

    Returns Pattern

Properties

describe

describe: DescribePattern

The function which describes this pattern given a Day to base it on.

listed

listed: boolean

Whether this pattern should be "listed" or not. Visual schedulers may provide a shortcut to describing and changing a Schedule through patterns and any pattern where listed is true could be an option in a list. The default patterns are all listed.

name

name: string

The name of this pattern. This is not typically displayed to a user, just to uniquely identify a pattern.

rules

The rules for matching a pattern to a Schedule or applying a pattern to a schedule.

Static PROPS

PROPS: DayProperty[] = ['dayOfWeek', 'dayOfMonth', 'lastDayOfMonth', 'dayOfYear','month', 'week', 'year','weekOfYear', 'weekspanOfYear', 'fullWeekOfYear', 'lastWeekspanOfYear', 'lastFullWeekOfYear','weekOfMonth', 'weekspanOfMonth', 'fullWeekOfMonth', 'lastWeekspanOfMonth', 'lastFullWeekOfMonth']

The properties in the ScheduleInput which are compared against the rules of a pattern.

Methods

apply

  • apply<M, I>(schedule: I, day: Day): I
  • Applies this pattern to a Schedule or ScheduleInput removing and adding any necessary properties from the input to match this pattern - based around the day provided.

    Type parameters

    Parameters

    • schedule: I

      The schedule to update to match this pattern.

    • day: Day

      The day to base the schedule on.

    Returns I

    The reference to the input passed in.

applyGeneric

  • applyGeneric(day: Day, setFrequency: function, removeFrequency: function): void
  • Applies this pattern to any object provided they implement the setFrequency and removeFrequency functions.

    Parameters

    • day: Day

      The day to base the schedule on.

    • setFrequency: function

      The function which sets the frequency on the object.

    • removeFrequency: function

      The function to remove a frequency from the object.

    Returns void

isMatch

  • isMatch<M, I>(schedule: I, exactlyWith?: Day): boolean
  • Determines whether the given Schedule or ScheduleInput matches this pattern. Optionally a day can be provided to make sure the day matches the schedule and pattern together.

    Type parameters

    Parameters

    • schedule: I

      The schedule input to test.

    • Optional exactlyWith: Day

      A day to further validate against for matching.

    Returns boolean

    true if the schedule was a match to this pattern with the day if one was provided, otherwise false.

isMatchGeneric

  • isMatchGeneric(getFrequency: function, exactlyWith?: Day): boolean
  • Determines whether the given input matches this pattern. Optionally a day can be provided to make sure the day matches the schedule and pattern together.

    Parameters

    Returns boolean

    true if the schedule input was a match to this pattern with the day if one was provided, otherwise false.

Static findMatch

  • findMatch<M, I>(input: I, listedOnly?: boolean, exactlyWith?: Day): Pattern
  • Finds a matching pattern to the given input searching through Patterns for matches. Optionally it will only look at patterns where listed = true.

    see

    Pattern.isMatch

    Type parameters

    Parameters

    • input: I

      The schedule input to use.

    • Default value listedOnly: boolean = true

      When true only patterns with Pattern.listed set to true will be looked at, otherwise all patterns are looked at.

    • Optional exactlyWith: Day

      A day to further validate against for matching.

    Returns Pattern

Static withName

  • Returns the pattern with the given name if one exists. If you add your own patterns make sure to add them to PatternMap.

    Parameters

    • name: string

      The name of the pattern to return.

    Returns Pattern

    The instance to the pattern with the same name.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc