@samitouri / QOS-React / commits / 5170db8e72

Remove unnecessary null (#8858)

* Remove unnecessary null * always return string

Edvin Erikson committed Jan 24, 2017 at 19:19 UTC 5170db8e72e1301205b82c8a4e69b38b019bb868
1 file changed +4 -4
src/shared/utils/getComponentName.js
+4 -4
@@ -15,11 +15,11 @@
15 import type { ReactInstance } from 'ReactInstanceType';
16 import type { Fiber } from 'ReactFiber';
17
18 -function getComponentName(instanceOrFiber : ReactInstance | Fiber) : string | null {
18 +function getComponentName(instanceOrFiber : ReactInstance | Fiber) : string {
19 if (typeof instanceOrFiber.getName === 'function') {
20 // Stack reconciler
21 const instance = ((instanceOrFiber : any) : ReactInstance);
22 - return instance.getName() || 'Component' || null;
22 + return instance.getName() || 'Component';
23 }
24 if (typeof instanceOrFiber.tag === 'number') {
25 // Fiber reconciler
@@ -29,10 +29,10 @@ function getComponentName(instanceOrFiber : ReactInstance | Fiber) : string | nu
29 return type;
30 }
31 if (typeof type === 'function') {
32 - return type.displayName || type.name || null;
32 + return type.displayName || type.name || 'Component';
33 }
34 }
35 - return null;
35 + return 'Component';
36 }
37
38 module.exports = getComponentName;