* Gets fulfilled callback namespace obj. * @param {CallExpression} importThen import().then() call * @returns {Identifier | ObjectPattern | undefined} the dynamic imported namespace obj
(importThen)
| 88 | * @returns {Identifier | ObjectPattern | undefined} the dynamic imported namespace obj |
| 89 | */ |
| 90 | function 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. |