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类类型以指定数据处理后下一步操作
Condition is a conditional filter that determines whether to continue the next operation, that based on the boolean value returned by the ConditionFn method.
Condition 是一个条件过滤器, 根据ConditionFn方法返回的boolean值决定是否继续next操作
const filter = new Condition({ fn: (index, value) => parseInt(value) > 0, }).next(Gather); filter.handle("100", (result) => console.log(result)); // ["undefined", "100"]; filter.handle("-100", (result) => console.log(result));