Options
All
  • Public
  • Public/Protected
  • All
Menu

Copy extends Divider, can copy results

example

const copy = new Copy({times: 3});
copy.next(Gather);
copy.handle(["key", "value"], (result) => console.log(result));
// ["key", "value"] * 3 times

Hierarchy

Index

Constructors

constructor

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