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

Function mapSingleChildIntoContext

bundle.js:2149–2167  ·  view source on GitHub ↗
(bookKeeping, child, childKey)

Source from the content-addressed store, hash-verified

2147 }
2148
2149 function mapSingleChildIntoContext(bookKeeping, child, childKey) {
2150 var result = bookKeeping.result,
2151 keyPrefix = bookKeeping.keyPrefix,
2152 func = bookKeeping.func,
2153 context = bookKeeping.context;
2154
2155 var mappedChild = func.call(context, child, bookKeeping.count++);
2156 if (Array.isArray(mappedChild)) {
2157 mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
2158 } else if (mappedChild != null) {
2159 if (ReactElement_1.isValidElement(mappedChild)) {
2160 mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
2161 // Keep both the (mapped) and old keys if they differ, just as
2162 // traverseAllChildren used to do for objects as children
2163 keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
2164 }
2165 result.push(mappedChild);
2166 }
2167 }
2168
2169 function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
2170 var escapedPrefix = '';

Callers

nothing calls this directly

Calls 2

escapeUserProvidedKeyFunction · 0.85

Tested by

no test coverage detected