Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MultiFn1<A, T>

Type parameters

  • A

  • T

Hierarchy

Callable

  • MultiFn1(a: A): T
  • Parameters

    • a: A

    Returns T

Index

Methods

add

  • Registers implementation for dispatch value id. Returns true, if successful. Returns false if an implementation already exists (and does nothing in this case).

    Parameters

    • id: PropertyKey

      implementation ID (dispatch value)

    • impl: Implementation1<A, T>

      implementation

    Returns boolean

addAll

  • Takes an object of dispatch values and their implementations and calls .add() for each KV pair. Returns true, if all impls were added successfully. Note: Only numbers or strings are accepted as dispatch values here.

    Parameters

    Returns boolean

ancestors

  • ancestors(id: PropertyKey): Set<PropertyKey>

callable

  • callable(...args: any[]): boolean
  • Returns true, if the function is callable (has a valid implementation) for given arguments.

    Parameters

    • Rest ...args: any[]

      arguments to find impl for

    Returns boolean

dependencies

  • dependencies(): IterableIterator<Pair<PropertyKey, undefined | PropertyKey>>
  • Returns iterator of all known dispatch values and their dependencies in the hierarchy of dispatch values. Each dependency is encoded as [value, parent-value?]. If parent-value is undefined, the dispatch value has no parent.

    Returns IterableIterator<Pair<PropertyKey, undefined | PropertyKey>>

impls

  • impls(): Set<PropertyKey>

isa

  • isa(id: PropertyKey, parent: PropertyKey): boolean
  • Updates dispatch hierarchy by declaring dispatch value id to delegate to parent's implementation. I.e. in terms of dispatch logic, id is considered the same as `parent.

    Parameters

    • id: PropertyKey

      implementation ID

    • parent: PropertyKey

      -parent implementation ID

    Returns boolean

parents

  • parents(id: PropertyKey): Set<PropertyKey>
  • Returns a set of immediate parent dispatch values for given dispatch value id.

    Parameters

    • id: PropertyKey

      implementation ID

    Returns Set<PropertyKey>

rels

  • rels(): IObjectOf<Set<PropertyKey>>
  • Returns all known dispatch relationships. This is an object with all registered dispatch values as keys, each with a set of parent dispatch values.

    Returns IObjectOf<Set<PropertyKey>>

remove

  • remove(id: PropertyKey): boolean

Generated using TypeDoc