MCPcopy
hub / github.com/victorporof/Sublime-HTMLPrettify / hasAllowedFileExtension

Function hasAllowedFileExtension

src/js/utils/fileUtils.js:27–34  ·  view source on GitHub ↗
(expectedType, filePath)

Source from the content-addressed store, hash-verified

25// Checks if a file is of a particular type by regexing the file name and
26// expecting a certain extension.
27const 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.

Callers 4

isCSSFunction · 0.85
isHTMLFunction · 0.85
isJSONFunction · 0.85
isJSFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected