| 1022 | const uniqueNamesFound = {}; |
| 1023 | |
| 1024 | const getSymbols = obj => |
| 1025 | Object.getOwnPropertyNames(obj) |
| 1026 | .filter(name => { |
| 1027 | if (name[0] === '_') { |
| 1028 | return false; |
| 1029 | } |
| 1030 | if (name in uniqueNamesFound) { |
| 1031 | return false; |
| 1032 | } |
| 1033 | |
| 1034 | uniqueNamesFound[name] = true; |
| 1035 | |
| 1036 | return true; |
| 1037 | }) |
| 1038 | .map(name => { |
| 1039 | let type; |
| 1040 | |
| 1041 | if (typeof obj[name] === 'function') { |
| 1042 | type = 'function'; |
| 1043 | } else if (name === name.toUpperCase()) { |
| 1044 | type = 'constant'; |
| 1045 | } else { |
| 1046 | type = 'variable'; |
| 1047 | } |
| 1048 | |
| 1049 | return { name, type }; |
| 1050 | }); |
| 1051 | |
| 1052 | misusedAtTopLevelCode = [].concat( |
| 1053 | getSymbols(fn), |