(expectedType, filePath)
| 25 | // Checks if a file is of a particular type by regexing the file name and |
| 26 | // expecting a certain extension. |
| 27 | const hasAllowedFileExtension = (expectedType, filePath) => { |
| 28 | for (const extension of (GLOBAL_FILE_RULES[expectedType] || {}).allowed_file_extensions || []) { |
| 29 | if (filePath.match(new RegExp(`\\.${extension}$`, 'i'))) { |
| 30 | return true; |
| 31 | } |
| 32 | } |
| 33 | return false; |
| 34 | }; |
| 35 | |
| 36 | // Checks if a file is of a particular type by regexing the syntax name and |
| 37 | // expecting a pattern. |