Options
All
  • Public
  • Public/Protected
  • All
Menu

Divider splits a result into multiple results by using the divide method, and then assigns Middleware to process each subsequent result through the next method. In addition, Divider provides a before/after method to specify the Filter to process result/results before/after divide.

Divider通过divide方法将一个result分裂为多个results,然后通过next方法指定Middleware处理后续每个result, 此外Divider提供before/after方法可在divide前后指定Filter对result/results进行处理

Type parameters

Hierarchy

Index

Constructors

constructor

  • new Divider(option: Option): Divider

Methods

after

  • The after method can specify Filter to process results after divide.

    after方法可在divide后指定Filter对分裂后的results进行处理

    Parameters

    Returns this

before

  • before(f: Filter<any>): this
  • The before method can specify Filter to process the original result before divide.

    before方法可在divide前指定Filter对原始result进行处理

    Parameters

    Returns this

handle

  • Handle is invoke method of Middleware. Result is the data to be processed. GatherCallback is a callback for processing. GatherCallback accepts Result | undefined.

    handle是Middleware类被调用时使用的方法, result为待处理Result类型, 如果传入值为string类型, 会自动转为["undefined", string] GatherCallback为处理完毕时的回调

    Parameters

    Returns void

next

  • The next method is same as the nextEach method when accepts Middleware However it provides a simple way by using Finisher Type.

    next方法同nextEach方法可以接受一个Middleware, 或者next可以接受Finisher类类型作为一种简写方式

    example
    
     // Gather extends Finisher
     divider.next(new Gather());
     divider.next(Gather);

    Parameters

    Returns this

nextEach

  • The nextEach method accepts a Middleware to handle each result.

    nextEach方法接受一个Middleware处理每个result

    Parameters

    Returns this

nextIndex

  • nextIndex(action: Array<Middleware<any>> | object): this
  • The nextList method accepts {[index:string]: Middleware} / Middleware[], and each Middleware handles the result corresponding to its index.

    nextList方法接受一个索引对象, 每个Middleware处理对应其index对应的result

    Parameters

    Returns this

nextList

  • The nextList method accepts Middleware array, and each Middleware processes result corresponding to index.

    nextList方法接受Middleware数组, 每个Middleware处理对应index的result

    Parameters

    Returns this