_.tap(value, interceptor)
This method invokes interceptor
and returns value
. The interceptor is invoked with one argument; (value). The purpose of this method is to "tap into" a method chain sequence in order to modify intermediate results.
Since
0.1.0
Arguments
value
(*): The value to provide tointerceptor
.interceptor
(Function): The function to invoke.
Returns
(*): Returns value
.
Example
_([1, 2, 3]).tap(function(array) {// Mutate input array.array.pop();}).reverse().value();// => [2, 1]
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .