Skip to content

Commit

Permalink
Fix youtube filter function
Browse files Browse the repository at this point in the history
Add a filter rule to remove multiple spaces.

Fixes #89.
  • Loading branch information
alexesprit committed Dec 11, 2020
1 parent 69fd273 commit 4f75bf0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export const TRIM_SYMBOLS_FILTER_RULES: FilterRule[] = [
{ source: /^[/,:;~-\s"]+/, target: '' },
// trim trailing white chars and dash
{ source: /[/,:;~-\s"]+$/, target: '' },
// remove multiple spaces
{ source: /\s{1,}/, target: ' ' },
];

/**
Expand Down
5 changes: 5 additions & 0 deletions test/function/youtube.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,9 @@ testFilterFunction(youtube, [
funcParameter: 'Track Title Sub Español',
expectedValue: 'Track Title',
},
{
description: 'should remove multiple spaces',
funcParameter: 'Imminent (Lyric Video) ft. Joshua Idehen',
expectedValue: 'Imminent ft. Joshua Idehen',
},
]);

0 comments on commit 4f75bf0

Please sign in to comment.