4.17.11
3.10.1
2.4.2
1.3.1

_.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

argument
value
interceptor
type
*
Function
description
The value to provide to `interceptor`.
The function to invoke.

Returns

(array)

Example

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