Spaces:
Sleeping
Sleeping
Download frontend/node_modules/@mui/utils/getDisplayName/getDisplayName.js from sepidnes/pythonic-rag-FastAPIReact: direct link, hf CLI and curl.
- Browser
- Download file 1.88 kB
-
https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/%40mui/utils/getDisplayName/getDisplayName.js
- Command line
-
hf download hf://spaces/sepidnes/pythonic-rag-FastAPIReact@56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/@mui/utils/getDisplayName/getDisplayName.js
-
curl -L -o getDisplayName.js https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/%40mui/utils/getDisplayName/getDisplayName.js
1.88 kB
| ; | |
| Object.defineProperty(exports, "__esModule", { | |
| value: true | |
| }); | |
| exports.default = getDisplayName; | |
| exports.getFunctionName = getFunctionName; | |
| var _reactIs = require("react-is"); | |
| // Simplified polyfill for IE11 support | |
| // https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3 | |
| const fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/; | |
| function getFunctionName(fn) { | |
| const match = `${fn}`.match(fnNameMatchRegex); | |
| const name = match && match[1]; | |
| return name || ''; | |
| } | |
| function getFunctionComponentName(Component, fallback = '') { | |
| return Component.displayName || Component.name || getFunctionName(Component) || fallback; | |
| } | |
| function getWrappedName(outerType, innerType, wrapperName) { | |
| const functionName = getFunctionComponentName(innerType); | |
| return outerType.displayName || (functionName !== '' ? `${wrapperName}(${functionName})` : wrapperName); | |
| } | |
| /** | |
| * cherry-pick from | |
| * https://github.com/facebook/react/blob/769b1f270e1251d9dbdce0fcbd9e92e502d059b8/packages/shared/getComponentName.js | |
| * originally forked from recompose/getDisplayName with added IE11 support | |
| */ | |
| function getDisplayName(Component) { | |
| if (Component == null) { | |
| return undefined; | |
| } | |
| if (typeof Component === 'string') { | |
| return Component; | |
| } | |
| if (typeof Component === 'function') { | |
| return getFunctionComponentName(Component, 'Component'); | |
| } | |
| // TypeScript can't have components as objects but they exist in the form of `memo` or `Suspense` | |
| if (typeof Component === 'object') { | |
| switch (Component.$$typeof) { | |
| case _reactIs.ForwardRef: | |
| return getWrappedName(Component, Component.render, 'ForwardRef'); | |
| case _reactIs.Memo: | |
| return getWrappedName(Component, Component.type, 'memo'); | |
| default: | |
| return undefined; | |
| } | |
| } | |
| return undefined; | |
| } |