Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 9, 2023
1 parent b35b70d commit a129b61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/util/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ export const getEntryPathFromManifest = (cwd: string, dir: string, manifest: Pac
}

if (exports) {
if (typeof exports === 'string') {
entryPaths.add(exports);
} else {
getStringValues(exports).forEach(item => entryPaths.add(item));
}
getStringValues(exports).forEach(item => entryPaths.add(item));
}

// Glob, as we only want source files that exist and not (generated) files that are .gitignore'd
Expand Down
1 change: 1 addition & 0 deletions src/util/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const getValuesByKeyDeep = (obj: any, key: string): unknown[] => {

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const getStringValues = (obj: any): string[] => {
if (typeof obj === 'string') return [obj];
let values: string[] = [];
for (const prop in obj) {
if (obj[prop]) {
Expand Down

0 comments on commit a129b61

Please sign in to comment.