MCPcopy
hub / github.com/redux-loop/redux-loop / handleParallelList

Function handleParallelList

src/cmd.js:73–96  ·  view source on GitHub ↗
({ cmds, batch = false }, context)

Source from the content-addressed store, hash-verified

71}
72
73function handleParallelList({ cmds, batch = false }, context) {
74 const promises = cmds
75 .map((nestedCmd) => {
76 const possiblePromise = executeCmdInternal(nestedCmd, context);
77 if (!possiblePromise || batch) {
78 return possiblePromise;
79 }
80
81 return possiblePromise.then((result) => {
82 return Promise.all(result.map((a) => context.wrappedDispatch(a)));
83 });
84 })
85 .filter((x) => x);
86
87 if (promises.length === 0) {
88 return null;
89 }
90
91 return Promise.all(promises)
92 .then(flatten)
93 .then((actions) => {
94 return batch ? actions : [];
95 });
96}
97
98function handleSequenceList({ cmds, batch = false }, context) {
99 const firstCmd = cmds.length ? cmds[0] : null;

Callers 1

executeCmdInternalFunction · 0.85

Calls 1

executeCmdInternalFunction · 0.85

Tested by

no test coverage detected