Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Box<Subject>

Box implements a declarative monadic link builder.

Type parameters

  • Subject

Hierarchy

  • Box

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Box(entity: Subject): Box

Properties

Protected entity

entity: Subject

Methods

expect

  • Assert an expectation on the yielded value.

    example
      // Simple expect
      cyr.wrap(2+2).expect().toBe(4)
    
      // Pluck `my.value` from the wrapped subject
      cyr.wrap({ my: { value: 'here' }}).expect('my').its('value').toBe('here')

    Type parameters

    Parameters

    • key: K

      (optional) Property on a previously yielded subject

    Returns Expectation<Subject[K]>

  • Returns Expectation<Subject>

Static empty

Static with

  • with<T>(e: T): Box<T>

Generated using TypeDoc