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为处理完毕时的回调
The next method accepts a Middleware class or Finisher class type to specify the next step after data processing.
next方法接受一个Middleware类或Finisher类类型以指定数据处理后下一步操作
Modify(extends Filter) can modify the index or value by modifying the expression or method. See ModifyOption for details.
Modify(extends Filter) 能够对index或value进行修改, 修改的方式是提供表达式或方法, 详见ModifyOption
new Modify({ index: "`prefix_${index}`", value: "value + 'ms'" , next: "Gather" }).handle(["load", "1000"], (result) => console.log(result)); // ["prefix_load", "1000ms"] new Modify({ index: "`${index}-${RegExp.$1}`", value: (index, value) => (RegExp.$2 + "ms"), regexp: /(\w+)=(\w+)/g, // or "/(\\w+)=(\\w+)/g" next: "Gather", // regexpTarget: "index", }).handle(["20180901", "load=1000"], (result) => console.log(result)); // ["20180901-load", "1000ms"]