Skip to main content

thru

_.thru(interceptor, value) # Ⓢ [Ⓣ][1]

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​

  1. interceptor (Function): The function to invoke.
  2. value (*): The value to provide to interceptor.

Returns​

(*): Returns the result of interceptor.

Example​

_('  abc  ')
.chain()
.trim()
.thru(function(value) {
return [value];
})
.value();
// => ['abc']