Options
All
  • Public
  • Public/Protected
  • All
Menu

Filter is a Middleware that processes single Result. Filter processing can be filtering, key-value conversion, calculation, deformation and other operations. After processing, Filter call the next Middleware to continue.

Filter是加工单个Result的Middleware, 处理完后调用next预先指定的Middleware继续下一步处理. Filter的处理的过程可以是过滤、键值转换、计算、变形等操作.

Type parameters

Hierarchy

Index

Constructors

Methods

Constructors

constructor

  • new Filter(option: Option): Filter

Methods

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 accepts a Middleware class or Finisher class type to specify the next step after data processing.

    next方法接受一个Middleware类或Finisher类类型以指定数据处理后下一步操作

    example
    
    deformat.nextEach(filterA);
    filterA.next(filterB);
    filterB.next(Gather);

    Parameters

    Returns Filter<Option>