forEachAccumulated.js — react Source File
Architecture documentation for forEachAccumulated.js, a javascript file in the react codebase. 0 imports, 3 dependents.
Entity Profile
Dependency Diagram
graph LR 03d71d90_7e04_8406_8321_a1aeecb7fa15["forEachAccumulated.js"] 577670f6_1f7f_5e0d_b9b6_894b69a76a73["ReactNativeBridgeEventPlugin.js"] 577670f6_1f7f_5e0d_b9b6_894b69a76a73 --> 03d71d90_7e04_8406_8321_a1aeecb7fa15 501868ac_ed82_decd_b0b4_e77c7390f910["EventBatching.js"] 501868ac_ed82_decd_b0b4_e77c7390f910 --> 03d71d90_7e04_8406_8321_a1aeecb7fa15 674c6180_b91e_e17d_fb2d_40a6a3631bb3["ResponderEventPlugin.js"] 674c6180_b91e_e17d_fb2d_40a6a3631bb3 --> 03d71d90_7e04_8406_8321_a1aeecb7fa15 style 03d71d90_7e04_8406_8321_a1aeecb7fa15 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/**
* @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 to
* allocate an array).
* @param {function} cb Callback invoked with each element or a collection.
* @param {?} [scope] Scope used as `this` in a callback.
*/
function forEachAccumulated<T>(
arr: ?(Array<T> | T),
cb: (elem: T) => void,
scope: ?any,
) {
if (Array.isArray(arr)) {
// $FlowFixMe[incompatible-call] if `T` is an array, `cb` cannot be called
arr.forEach(cb, scope);
} else if (arr) {
cb.call(scope, arr);
}
}
export default forEachAccumulated;
Domain
Imported By
Source
Frequently Asked Questions
What does forEachAccumulated.js do?
forEachAccumulated.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What files import forEachAccumulated.js?
forEachAccumulated.js is imported by 3 file(s): EventBatching.js, ReactNativeBridgeEventPlugin.js, ResponderEventPlugin.js.
Where is forEachAccumulated.js in the architecture?
forEachAccumulated.js is located at packages/react-native-renderer/src/legacy-events/forEachAccumulated.js (domain: BabelCompiler, directory: packages/react-native-renderer/src/legacy-events).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free