Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function filterFiles(files: string[], suffix: string): string[] {
- return files.filter(file => {
- const fileName = file.toLowerCase();
- return (fileName.includes(suffix) || fileName.includes('_v3')) &&
- (fileName.endsWith(suffix) || fileName.endsWith('_v3'));
- });
- }
- // Változó értéke
- const suffix = "sa";
- // Teszteset:
- const files = ["weapons.txt", "weapons_sa.txt", "weapons_v3.txt", "something_v3_else_sa.txt", "file_v4.txt"];
- const filteredFiles = filterFiles(files, suffix);
- console.log(filteredFiles);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement