330bfb99737058663801077a0408a0da638db589
[yaffs-website] / node_modules / uncss / node_modules / lodash / tap.js
1 /**
2  * This method invokes `interceptor` and returns `value`. The interceptor is
3  * invoked with one argument; (value). The purpose of this method is to "tap into"
4  * a method chain in order to perform operations on intermediate results within
5  * the chain.
6  *
7  * @static
8  * @memberOf _
9  * @category Seq
10  * @param {*} value The value to provide to `interceptor`.
11  * @param {Function} interceptor The function to invoke.
12  * @returns {*} Returns `value`.
13  * @example
14  *
15  * _([1, 2, 3])
16  *  .tap(function(array) {
17  *    array.pop();
18  *  })
19  *  .reverse()
20  *  .value();
21  * // => [2, 1]
22  */
23 function tap(value, interceptor) {
24   interceptor(value);
25   return value;
26 }
27
28 module.exports = tap;