Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
feat: Use glob to match excluded files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Apr 14, 2022
1 parent 9e75a23 commit 66989da
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Snippet-downloader/utils.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {snippetDownloaderSettings} from "./settings";

import globRegex from 'glob-regex';
export function searchExcluded(settings: snippetDownloaderSettings, name: string): boolean {
const excluded = settings.excludedSnippet.split(",");
if (excluded.length <= 1) {
if (settings.excludedSnippet.length < 1) {
return false;
}
const excluded = settings.excludedSnippet.split(",");
for (const excl of excluded){
if (excl.trim() === name.replace('.css', '')){
return true;
}
const regExcl = new RegExp(excl.trim());
const regExcl = globRegex(excl.trim());
if (name.match(regExcl)){
return true;
}
Expand Down

0 comments on commit 66989da

Please sign in to comment.