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

Function getComponentKey

code/dependency-injection/public/app.js:19250–19259  ·  view source on GitHub ↗

* Generate a key string that identifies a component within a set. * * @param {*} component A component that could contain a manual key. * @param {number} index Index that is used if a manual key is not provided. * @return {string}

(component, index)

Source from the content-addressed store, hash-verified

19248 * @return {string}
19249 */
19250function getComponentKey(component, index) {
19251 // Do some typechecking here since we call this blindly. We want to ensure
19252 // that we don't block potential future ES APIs.
19253 if (typeof component === 'object' && component !== null && component.key != null) {
19254 // Explicit key
19255 return escape(component.key);
19256 }
19257 // Implicit key determined by the index in the set
19258 return index.toString(36);
19259}
19260
19261function forEachSingleChild(bookKeeping, child, name) {
19262 var func = bookKeeping.func,

Callers 1

traverseAllChildrenImplFunction · 0.70

Calls 1

escapeFunction · 0.70

Tested by

no test coverage detected