Skip to content

Commit dda49b0

Browse files
mrseanryanpzavolinsky
authored andcommitted
Simplify getKey()
1 parent ad5aa3d commit dda49b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/parser/import.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const addImportCore = (
7777
): string | undefined => {
7878
const { from, what } = fw;
7979

80-
const getKey = (from: string): string | undefined => {
80+
const getKey = (from: string): string => {
8181
if (from[0] == '.') {
8282
// An undefined return indicates the import is from 'index.ts' or similar == '.'
8383
return relativeTo(rootDir, path, from) || '.';
@@ -104,11 +104,11 @@ export const addImportCore = (
104104
.replace(`${baseDir}${sep}`, '');
105105
}
106106

107-
return undefined;
107+
return from;
108108
}
109109
};
110110

111-
const key = getKey(from) || from;
111+
const key = getKey(from);
112112
const items = imports[key] || [];
113113

114114
imports[key] = items.concat(what).filter(isUnique);

0 commit comments

Comments
 (0)