Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Accumulator<T>

Accumulator class for doing all merging action

export
class

Accumulator

template

T

Type parameters

  • T

Hierarchy

  • Accumulator

Index

Constructors

constructor

Methods

add

  • add(item?: AcceptedTargets<T>): this
  • add item(s) after instance created

    memberof

    Accumulator

    Parameters

    • Optional item: AcceptedTargets<T>

    Returns this

clone

  • Clone a new instance of Accumulator with same items inside, optional parameter item can be passed into it for adding into the new Accumulator at the same time

    memberof

    Accumulator

    Parameters

    • Optional add: AcceptedTargets<T>

    Returns Accumulator<T>

extract

  • extract(extractor: function | string, config?: ExtractionConfig): any
  • Extract single value from Accumulator, can use string key or extractor callback

    memberof

    Accumulator

    Parameters

    • extractor: function | string
    • Default value config: ExtractionConfig = {}

    Returns any

merge

  • merge(config?: ExtractionConfig | string[]): T
  • Merge whole object

    memberof

    Accumulator

    Parameters

    • Optional config: ExtractionConfig | string[]

    Returns T

registerKeys

  • registerKeys(keys: string[]): void
  • Manually register keys when the index of object may not appear at the beginning of creating Accumulator, by using this function yan can let Accumulator knows there are additional keys when merging

    memberof

    Accumulator

    Parameters

    • keys: string[]

    Returns void

Static from

  • Static builder for creating instance, this method accept various type of item for making new Accumulator. Including single item, array of items, single Accumulator, array of Accumulators. This static method will process these kinds of input into Accumulator

    static
    template

    T

    memberof

    Accumulator

    Type parameters

    • T

    Parameters

    • Optional item: AcceptedTargets<T>

    Returns Accumulator<T>

Generated using TypeDoc