MCPcopy
hub / github.com/webpack/webpack / getFulfilledCallbackNamespaceObj

Function getFulfilledCallbackNamespaceObj

lib/dependencies/ImportParserPlugin.js:90–102  ·  view source on GitHub ↗

* Gets fulfilled callback namespace obj. * @param {CallExpression} importThen import().then() call * @returns {Identifier | ObjectPattern | undefined} the dynamic imported namespace obj

(importThen)

Source from the content-addressed store, hash-verified

88 * @returns {Identifier | ObjectPattern | undefined} the dynamic imported namespace obj
89 */
90function getFulfilledCallbackNamespaceObj(importThen) {
91 const fulfilledCallback = importThen.arguments[0];
92 if (
93 fulfilledCallback &&
94 (fulfilledCallback.type === "ArrowFunctionExpression" ||
95 fulfilledCallback.type === "FunctionExpression") &&
96 fulfilledCallback.params[0] &&
97 (fulfilledCallback.params[0].type === "Identifier" ||
98 fulfilledCallback.params[0].type === "ObjectPattern")
99 ) {
100 return fulfilledCallback.params[0];
101 }
102}
103
104/**
105 * Walk import then fulfilled callback.

Callers 1

applyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected