main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
672 bytes
|
Rev | Line | |
---|
[d565449] | 1 | /**
|
---|
| 2 | * This method is like `_.tap` except that it returns the result of `interceptor`.
|
---|
| 3 | * The purpose of this method is to "pass thru" values replacing intermediate
|
---|
| 4 | * results in a method chain sequence.
|
---|
| 5 | *
|
---|
| 6 | * @static
|
---|
| 7 | * @memberOf _
|
---|
| 8 | * @since 3.0.0
|
---|
| 9 | * @category Seq
|
---|
| 10 | * @param {*} value The value to provide to `interceptor`.
|
---|
| 11 | * @param {Function} interceptor The function to invoke.
|
---|
| 12 | * @returns {*} Returns the result of `interceptor`.
|
---|
| 13 | * @example
|
---|
| 14 | *
|
---|
| 15 | * _(' abc ')
|
---|
| 16 | * .chain()
|
---|
| 17 | * .trim()
|
---|
| 18 | * .thru(function(value) {
|
---|
| 19 | * return [value];
|
---|
| 20 | * })
|
---|
| 21 | * .value();
|
---|
| 22 | * // => ['abc']
|
---|
| 23 | */
|
---|
| 24 | function thru(value, interceptor) {
|
---|
| 25 | return interceptor(value);
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | export default thru;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.