1 var LazyWrapper = require('./LazyWrapper');
3 /** Used for native method references. */
4 var arrayProto = Array.prototype;
6 /** Native method references. */
7 var push = arrayProto.push;
10 * The base implementation of `wrapperValue` which returns the result of
11 * performing a sequence of actions on the unwrapped `value`, where each
12 * successive action is supplied the return value of the previous.
15 * @param {*} value The unwrapped value.
16 * @param {Array} actions Actions to peform to resolve the unwrapped value.
17 * @returns {*} Returns the resolved value.
19 function baseWrapperValue(value, actions) {
21 if (result instanceof LazyWrapper) {
22 result = result.value();
25 length = actions.length;
27 while (++index < length) {
29 action = actions[index];
31 push.apply(args, action.args);
32 result = action.func.apply(action.thisArg, args);
37 module.exports = baseWrapperValue;