_.thru
语法:
_.thru(value, interceptor)源代码链接:source
描述:
这个方法类似_.tap, 除了它返回interceptor的返回结果。该方法的目的是"传递" 值到一个方法链序列以取代中间结果。
开始版本:3.0.0
参数:
value (*): 提供给 interceptor 的值。interceptor (Function): 用来调用的函数。
返回值:
(*): 返回 interceptor 的返回结果。
例子:
_(' abc ')
.chain()
.trim()
.thru(function(value) {
return [value];
})
.value();
// => ['abc']Last updated
Was this helpful?