Options
All
  • Public
  • Public/Protected
  • All
Menu

The class which takes user input and parses it to specific structures.

Hierarchy

  • Parse

Index

Methods

Static cron

  • Parses a schedule from a CRON pattern. TODO

    Type parameters

    • M

    Parameters

    • pattern: string
    • Default value out: Schedule<M> = new Schedule<M>()

    Returns Schedule<M>

Static day

  • Parses DayInput into a Day instance.

    Parse.day( 65342300 );               // UTC timestamp
    Parse.day( '01/02/2014' );           // strings in many formats
    Parse.day( day );                    // return a passed instance
    Parse.day( [2018, 0, 2] );           // array: 01/02/2018
    Parse.day( {year: 2018, month: 2} ); // object: 03/01/2018
    Parse.day( true );                   // today

    Parameters

    Returns Day

    The Day parsed or null if the value is not valid.

Static event

  • event<T, M>(input: any, parseData?: function, parseMeta?: function): Event<T, M>
  • Parses EventInput and returns an Event.

    Type parameters

    • T

    • M

    Parameters

    • input: any

      The input to parse.

    • Default value parseData: function = (x => x)

      A function to use when parsing data input into the desired type.

        • (input: any): T
        • Parameters

          • input: any

          Returns T

    • Default value parseMeta: function = (x => x)

      A function to use when parsing meta input into the desired type.

        • (input: any): M
        • Parameters

          • input: any

          Returns M

    Returns Event<T, M>

    The parsed value.

Static frequency

Static givenFrequency

  • Parses an array of FrequencyCheck functions and returns an array of functions for only the checks that were specified by the user.

    Parameters

    • checks: FrequencyCheck[]

      The array of check functions to filter through.

    Returns FrequencyCheck[]

    The array of user specified checks.

Static modifier

  • Parses an array of excluded days into a map of excluded days where the array value and returned object key are Day.dayIdentifier.

    Parse.modifier( [ 20180101, 20140506 ] );            // {'20180101': true, '20140506': true}
    Parse.modifier( [ 20180101, Day.build(2014,4,6) ] ); // {'20180101': true, '20140506': true}
    see

    Day.dayIdentifier

    Type parameters

    • T

    Parameters

    • input: any

      The input to parse.

    • value: T

      The default value if the input given is an array of identifiers.

    • Default value parseMeta: function = (x => x)

      A function to use to parse a modifier.

        • (input: any): T
        • Parameters

          • input: any

          Returns T

    • Default value out: ScheduleModifier<T> = new ScheduleModifier<T>()

      The modifier to set the identifiers and values of and return.

    Returns ScheduleModifier<T>

    The object with identifier keys and true values.

Static schedule

  • Parses an object which specifies a schedule where events may or may not repeat and they may be all day events or at specific times.

    Type parameters

    • M

    Parameters

    • input: ScheduleInput<M> | Schedule<M>

      The input to parse into a schedule.

    • Default value parseMeta: function = (x => x)

      A function to use when parsing meta input into the desired type.

        • (input: any): M
        • Parameters

          • input: any

          Returns M

    • Default value out: Schedule<M> = new Schedule<M>()

      The schedule to set the values of and return.

    Returns Schedule<M>

    An instance of the parsed Schedule.

Static time

  • time(input: any): Time
  • Parses a value and tries to convert it to a Time instance.

    Parse.time( time );      // return a passed instance
    Parse.time( 9 );         // 09:00:00.000
    Parse.time( 3009 );      // 09:30:00.000
    Parse.time( 593009 );    // 09:30:59.000
    Parsetime( '09' );       // 09:00:00.000
    Parse.time( '9:30' );    // 09:30:00.000
    Parse.time( '9:30:59' ); // 09:30:59.000
    Parse.time( {hour: 2} ); // 02:00:00.000
    see

    Time.fromIdentifier

    see

    Time.fromString

    Parameters

    • input: any

      The input to parse.

    Returns Time

    The instance parsed or null if it was invalid.

Static times

  • times(input: any): Time[]
  • Parses a value and tries to convert it to an array of Time instances. If any of the given values are not a valid time value then the resulting array will not contain a time instance.

    see

    Parse.time

    Parameters

    • input: any

      The input to parse.

    Returns Time[]

    A non-null array of time instances.

Static unit

  • unit(input: string, all?: boolean): Unit
  • Parameters

    • input: string
    • Default value all: boolean = false

    Returns Unit

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