ae77ddcbd01f482aa85d25966cc19a680f7bf8245cd28e8e2dd8448d7cca65c4921fdc55eb85b1fd6764d741e6c55620f7f1f0537e8098be588ecb53ef4ba7 855 B

12345678910111213141516171819202122232425
  1. import LazyWrapper from './_LazyWrapper.js';
  2. import arrayPush from './_arrayPush.js';
  3. import arrayReduce from './_arrayReduce.js';
  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 perform 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. return arrayReduce(actions, function(result, action) {
  20. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21. }, result);
  22. }
  23. export default baseWrapperValue;