MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / forEachAccumulated

Function forEachAccumulated

code/one-direction-data-flow/public/app.js:2103–2109  ·  view source on GitHub ↗

* @param {array} arr an "accumulation" of items which is either an Array or * a single item. Useful when paired with the `accumulate` module. This is a * simple utility that allows us to reason about a collection of items, but * handling the case when there is exactly one item (and we do not need

(arr, cb, scope)

Source from the content-addressed store, hash-verified

2101 * @param {?} [scope] Scope used as `this` in a callback.
2102 */
2103function forEachAccumulated(arr, cb, scope) {
2104 if (Array.isArray(arr)) {
2105 arr.forEach(cb, scope);
2106 } else if (arr) {
2107 cb.call(scope, arr);
2108 }
2109}
2110
2111/**
2112 * Internal queue of events that have accumulated their dispatches and are

Callers 4

runEventsInBatchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected