(bufferContents)
| 68 | }; |
| 69 | |
| 70 | export const isHTML = (bufferContents) => { |
| 71 | const isSavedFile = ORIGINAL_FILE_PATH !== '?'; |
| 72 | const useEditorFileSyntaxForDeterminingFileType = EDITOR_FILE_SYNTAX !== '?'; |
| 73 | |
| 74 | const isAllowedExtension = hasAllowedFileExtension('html', ORIGINAL_FILE_PATH); |
| 75 | const isAllowedSyntax = hasAllowedFileSyntax('html', EDITOR_FILE_SYNTAX); |
| 76 | const isDisallowedFilePattern = hasDisallowedFilePathPattern('html', ORIGINAL_FILE_PATH); |
| 77 | const isMaybeHtml = bufferContents.match(/^\s*</); |
| 78 | |
| 79 | if (!isSavedFile) { |
| 80 | return useEditorFileSyntaxForDeterminingFileType |
| 81 | ? isAllowedSyntax || isMaybeHtml |
| 82 | : isMaybeHtml; |
| 83 | } |
| 84 | |
| 85 | if (isDisallowedFilePattern) { |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | return useEditorFileSyntaxForDeterminingFileType |
| 90 | ? isAllowedSyntax || isAllowedExtension |
| 91 | : isAllowedExtension; |
| 92 | }; |
| 93 | |
| 94 | export const isJSON = (bufferContents) => { |
| 95 | const isSavedFile = ORIGINAL_FILE_PATH !== '?'; |
nothing calls this directly
no test coverage detected