Skip to content

Commit

Permalink
fix: enhance alias detection
Browse files Browse the repository at this point in the history
fix #4
  • Loading branch information
fsmaia committed Apr 23, 2020
1 parent a03536e commit 379c397
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { IStyleAPI, IStyleItem } from 'import-sort-style';

import { IImport } from 'import-sort-parser';
import { IStyleAPI, IStyleItem } from 'import-sort-style';

export interface Options {
alias: string[];
}

const hasAlias = (aliases: string[]) => (imported: IImport): boolean =>
aliases.some(
(alias: string): boolean => imported.moduleName.indexOf(alias) === 0
(alias: string): boolean =>
imported.moduleName === alias ||
imported.moduleName.indexOf(`${alias}/`) === 0
);

export default (
Expand Down

0 comments on commit 379c397

Please sign in to comment.