MCPcopy Index your code
hub / github.com/caseywebdev/react-list / mapIntoArray

Function mapIntoArray

docs/index.js:194–302  ·  view source on GitHub ↗
(children, array, escapedPrefix, nameSoFar, callback)

Source from the content-addressed store, hash-verified

192 throw thenable;
193}
194function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
195 var type = typeof children;
196 if ("undefined" === type || "boolean" === type) children = null;
197 var invokeCallback = !1;
198 if (null === children) invokeCallback = !0;
199 else
200 switch (type) {
201 case "bigint":
202 case "string":
203 case "number":
204 invokeCallback = !0;
205 break;
206 case "object":
207 switch (children.$$typeof) {
208 case REACT_ELEMENT_TYPE:
209 case REACT_PORTAL_TYPE:
210 invokeCallback = !0;
211 break;
212 case REACT_LAZY_TYPE:
213 return (
214 (invokeCallback = children._init),
215 mapIntoArray(
216 invokeCallback(children._payload),
217 array,
218 escapedPrefix,
219 nameSoFar,
220 callback
221 )
222 );
223 }
224 }
225 if (invokeCallback)
226 return (
227 (callback = callback(children)),
228 (invokeCallback =
229 "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
230 isArrayImpl(callback)
231 ? ((escapedPrefix = ""),
232 null != invokeCallback &&
233 (escapedPrefix =
234 invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
235 mapIntoArray(callback, array, escapedPrefix, "", function (c) {
236 return c;
237 }))
238 : null != callback &&
239 (isValidElement(callback) &&
240 (callback = cloneAndReplaceKey(
241 callback,
242 escapedPrefix +
243 (null == callback.key ||
244 (children && children.key === callback.key)
245 ? ""
246 : ("" + callback.key).replace(
247 userProvidedKeyEscapeRegex,
248 "$&/"
249 ) + "/") +
250 invokeCallback
251 )),

Callers 1

mapChildrenFunction · 0.85

Calls 6

getElementKeyFunction · 0.85
isValidElementFunction · 0.85
cloneAndReplaceKeyFunction · 0.85
getIteratorFnFunction · 0.85
resolveThenableFunction · 0.85
checkKeyStringCoercionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…