(functionName: void | string)
| 958 | } |
| 959 | |
| 960 | function parseHookName(functionName: void | string): string { |
| 961 | if (!functionName) { |
| 962 | return ''; |
| 963 | } |
| 964 | let startIndex = functionName.lastIndexOf('[as '); |
| 965 | |
| 966 | if (startIndex !== -1) { |
| 967 | // Workaround for sourcemaps in Jest and Chrome. |
| 968 | // In `node --enable-source-maps`, we don't see "Object.useHostTransitionStatus [as useFormStatus]" but "Object.useFormStatus" |
| 969 | // "Object.useHostTransitionStatus [as useFormStatus]" -> "useFormStatus" |
| 970 | return parseHookName(functionName.slice(startIndex + '[as '.length, -1)); |
| 971 | } |
| 972 | startIndex = functionName.lastIndexOf('.'); |
| 973 | if (startIndex === -1) { |
| 974 | startIndex = 0; |
| 975 | } else { |
| 976 | startIndex += 1; |
| 977 | } |
| 978 | |
| 979 | if (functionName.slice(startIndex).startsWith('unstable_')) { |
| 980 | startIndex += 'unstable_'.length; |
| 981 | } |
| 982 | |
| 983 | if (functionName.slice(startIndex).startsWith('experimental_')) { |
| 984 | startIndex += 'experimental_'.length; |
| 985 | } |
| 986 | |
| 987 | if (functionName.slice(startIndex, startIndex + 3) === 'use') { |
| 988 | if (functionName.length - startIndex === 3) { |
| 989 | return 'Use'; |
| 990 | } |
| 991 | startIndex += 3; |
| 992 | } |
| 993 | return functionName.slice(startIndex); |
| 994 | } |
| 995 | |
| 996 | function buildTree( |
| 997 | rootStack: ParsedStackFrame[], |
no outgoing calls
no test coverage detected