_.thru(value, interceptor)
This method is like _.tap
except that it returns the result of interceptor
. The purpose of this method is to "pass thru" values replacing intermediate results in a method chain sequence.
Since
3.0.0
Arguments
value
(*): The value to provide tointerceptor
.interceptor
(Function): The function to invoke.
Returns
(*): Returns the result of interceptor
.
Example
_(' abc ').chain().trim().thru(function(value) {return [value];}).value();// => ['abc']
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .