Options
All
  • Public
  • Public/Protected
  • All
Menu

Reverse(extends Filter) exchanges index and value.

Reverse是一个会交换index与value的Filter

example

new Reverse().next(Gather).handle(
   ["a", "b"],
   (result) => console.log(result),
);
// ["b", "a"]

Type parameters

Hierarchy

Index

Constructors

Methods

Constructors

constructor

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>