Skip to content

Commit

Permalink
Merge pull request #1 from kanwal019/whyboris#617
Browse files Browse the repository at this point in the history
  • Loading branch information
kanwal019 authored Jan 18, 2021
2 parents bdea404 + a0d9d10 commit 9c8b0d2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions node/main-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,9 @@ export function createDotPlsFile(savePath: string, playlist: ImageElement[], sou
export function cleanUpFileName(original: string): string {
return original.split('.').slice(0, -1).join('.') // (1)
.split('_').join(' ') // (2)
.split('.').join(' ') // (3)
.split(/\s+/).join(' ') // (4)
.split('-').join(' ') // (3)
.split('.').join(' ') // (4)
.split(/\s+/).join(' ') // (5)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/app/pipes/file-search.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export class FileSearchPipe implements PipeTransform {
searchString += ' ' + item.partialPath.replace(/(\/)/, ' ');
}
}

if (searchString.toLowerCase().indexOf(element.toLowerCase()) !== -1) {
const regex = new RegExp(`\\b${element.toLowerCase()}`, 'i');
if (regex.test(searchString.toLowerCase())) {
matchFound++;
}
});
Expand Down
6 changes: 4 additions & 2 deletions src/app/pipes/magic-search.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ export class MagicSearchPipe implements PipeTransform {
return finalArray;
} else {
// console.log('magic search pipe working');
const regex = new RegExp(`\\b${searchString.toLowerCase()}`, 'i');
return finalArray.filter(item =>
item.partialPath.toLowerCase().indexOf(searchString.toLowerCase()) !== -1
|| item.fileName.toLowerCase().indexOf(searchString.toLowerCase()) !== -1
regex.test(item.partialPath.toLowerCase())
|| (regex.test(item.fileName.toLowerCase())
|| regex.test(item.cleanName.toLowerCase()))
);
}
}
Expand Down

0 comments on commit 9c8b0d2

Please sign in to comment.