main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
855 bytes
|
Line | |
---|
1 | import LazyWrapper from './_LazyWrapper.js';
|
---|
2 | import arrayPush from './_arrayPush.js';
|
---|
3 | import arrayReduce from './_arrayReduce.js';
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * The base implementation of `wrapperValue` which returns the result of
|
---|
7 | * performing a sequence of actions on the unwrapped `value`, where each
|
---|
8 | * successive action is supplied the return value of the previous.
|
---|
9 | *
|
---|
10 | * @private
|
---|
11 | * @param {*} value The unwrapped value.
|
---|
12 | * @param {Array} actions Actions to perform to resolve the unwrapped value.
|
---|
13 | * @returns {*} Returns the resolved value.
|
---|
14 | */
|
---|
15 | function baseWrapperValue(value, actions) {
|
---|
16 | var result = value;
|
---|
17 | if (result instanceof LazyWrapper) {
|
---|
18 | result = result.value();
|
---|
19 | }
|
---|
20 | return arrayReduce(actions, function(result, action) {
|
---|
21 | return action.func.apply(action.thisArg, arrayPush([result], action.args));
|
---|
22 | }, result);
|
---|
23 | }
|
---|
24 |
|
---|
25 | export default baseWrapperValue;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.