MCPcopy Create free account
hub / github.com/danielstocks/react-sortable / getComponentKey

Function getComponentKey

bundle.js:2110–2119  ·  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

2108 * @return {string}
2109 */
2110 function getComponentKey(component, index) {
2111 // Do some typechecking here since we call this blindly. We want to ensure
2112 // that we don't block potential future ES APIs.
2113 if ((typeof component === 'undefined' ? 'undefined' : _typeof(component)) === 'object' && component !== null && component.key != null) {
2114 // Explicit key
2115 return escape(component.key);
2116 }
2117 // Implicit key determined by the index in the set
2118 return index.toString(36);
2119 }
2120
2121 function forEachSingleChild(bookKeeping, child, name) {
2122 var func = bookKeeping.func,

Callers 1

traverseAllChildrenImplFunction · 0.85

Calls 1

escapeFunction · 0.85

Tested by

no test coverage detected