Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / baseWrapperValue.js
1 var LazyWrapper = require('./LazyWrapper'),
2     arrayPush = require('./arrayPush');
3
4 /**
5  * The base implementation of `wrapperValue` which returns the result of
6  * performing a sequence of actions on the unwrapped `value`, where each
7  * successive action is supplied the return value of the previous.
8  *
9  * @private
10  * @param {*} value The unwrapped value.
11  * @param {Array} actions Actions to peform to resolve the unwrapped value.
12  * @returns {*} Returns the resolved value.
13  */
14 function baseWrapperValue(value, actions) {
15   var result = value;
16   if (result instanceof LazyWrapper) {
17     result = result.value();
18   }
19   var index = -1,
20       length = actions.length;
21
22   while (++index < length) {
23     var action = actions[index];
24     result = action.func.apply(action.thisArg, arrayPush([result], action.args));
25   }
26   return result;
27 }
28
29 module.exports = baseWrapperValue;