Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Spec

Abstract class representing Spec, the main specification of perusal-immutable. Declares the abstract method assert and explain which is used by the utility methods ofr validity checking and specification assertion on a given value.

Hierarchy

Constructors

Properties

Methods

Constructors

constructor

  • new Spec(name: string, options: any): Spec
  • Parameters

    • name: string
    • options: any

    Returns Spec

Properties

name

name: string

options

options: any

Methods

assert

  • assert(value: any): any
  • Asserts this spec on a given value.

    throws

    Error on call - subclasses should all implement the assert method.

    throws

    Error on call - subclasses should all implement the assert method.

    Parameters

    • value: any

      The value to be asserted.

    Returns any

explain

  • explain(value: any, path: String[]): void
  • Expplains why a given value passes/fails this spec.

    throws

    Error on call - subclasses should all implement the explain method.

    throws

    Error on call - subclasses should all implement the explain method.

    Parameters

    • value: any

      The value to be asserted.

    • path: String[]

      The path travelled to this spec.

    Returns void

Generated using TypeDoc