(bufferContents)
| 116 | }; |
| 117 | |
| 118 | export const isJS = (bufferContents) => { |
| 119 | const isSavedFile = ORIGINAL_FILE_PATH !== '?'; |
| 120 | const useEditorFileSyntaxForDeterminingFileType = EDITOR_FILE_SYNTAX !== '?'; |
| 121 | |
| 122 | const isAllowedExtension = hasAllowedFileExtension('js', ORIGINAL_FILE_PATH); |
| 123 | const isAllowedSyntax = hasAllowedFileSyntax('js', EDITOR_FILE_SYNTAX); |
| 124 | const isDisallowedFilePattern = hasDisallowedFilePathPattern('js', ORIGINAL_FILE_PATH); |
| 125 | const isMaybeJs = !bufferContents.match(/^\s*</); |
| 126 | |
| 127 | if (!isSavedFile) { |
| 128 | return useEditorFileSyntaxForDeterminingFileType |
| 129 | ? isAllowedSyntax || isMaybeJs |
| 130 | : isMaybeJs; |
| 131 | } |
| 132 | |
| 133 | if (isDisallowedFilePattern) { |
| 134 | return false; |
| 135 | } |
| 136 | |
| 137 | return useEditorFileSyntaxForDeterminingFileType |
| 138 | ? isAllowedSyntax || isAllowedExtension |
| 139 | : isAllowedExtension; |
| 140 | }; |
| 141 | |
| 142 | // Checks if a file path matches a particular glob string. |
| 143 | export const isMatchingGlob = (globString) => { |
nothing calls this directly
no test coverage detected