// Fork of recompose/getDisplayName with added IE 11 support // Simplified polyfill for IE 11 support // https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3 const fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/; export function getFunctionName(fn) { const match = `${fn}`.match(fnNameMatchRegex); const name = match && match[1]; return name || ''; } function getDisplayName(Component) { if (typeof Component === 'string') { return Component; } if (!Component) { return undefined; } return Component.displayName || Component.name || getFunctionName(Component) || 'Component'; } export default getDisplayName;