@@ -21,35 +21,37 @@ import { parse as parsePath } from 'node:path'
2121
2222type MimeType = string
2323
24- const MIME_TEXT_PLAIN : MimeType = 'text/plain'
24+ const MIMETYPE_TEXT_PLAIN : MimeType = 'text/plain'
2525
26- const MAP_TEXT_EXTENSION_MIME : Readonly < Record < string , MimeType > > = {
27- '' : MIME_TEXT_PLAIN ,
26+ const MAP_TEXT_EXTENSION_MIMETYPE : Readonly < Record < string , MimeType > > = {
27+ '' : MIMETYPE_TEXT_PLAIN ,
2828 // https://www.iana.org/assignments/media-types/media-types.xhtml
2929 '.csv' : 'text/csv' ,
3030 '.htm' : 'text/html' ,
3131 '.html' : 'text/html' ,
3232 '.md' : 'text/markdown' ,
33- '.txt' : MIME_TEXT_PLAIN ,
33+ '.txt' : MIMETYPE_TEXT_PLAIN ,
3434 '.rst' : 'text/prs.fallenstein.rst' ,
3535 '.xml' : 'text/xml' , // not `application/xml` -- our scope is text!
36+ // to be continued ... pullrequests welcome
3637 // add more mime types above this line. pull-requests welcome!
3738 // license-specific files
38- '.license' : MIME_TEXT_PLAIN ,
39- '.licence' : MIME_TEXT_PLAIN
39+ '.license' : MIMETYPE_TEXT_PLAIN ,
40+ '.licence' : MIMETYPE_TEXT_PLAIN ,
4041} as const
4142
4243const LICENSE_FILENAME_BASE = new Set ( [ 'licence' , 'license' ] )
4344const LICENSE_FILENAME_EXT = new Set ( [
4445 '.apache' ,
4546 '.bsd' ,
4647 '.gpl' ,
47- '.mit'
48+ '.mit' ,
49+ // to be continued ... pullrequests welcome
4850] )
4951
50- export function getMimeForLicenseFile ( filename : string ) : MimeType | undefined {
52+ export function getMimeTypeForLicenseFile ( filename : string ) : MimeType | undefined {
5153 const { name, ext} = parsePath ( filename . toLowerCase ( ) )
5254 return LICENSE_FILENAME_BASE . has ( name ) && LICENSE_FILENAME_EXT . has ( ext )
53- ? MIME_TEXT_PLAIN
54- : MAP_TEXT_EXTENSION_MIME [ ext ]
55+ ? MIMETYPE_TEXT_PLAIN
56+ : MAP_TEXT_EXTENSION_MIMETYPE [ ext ]
5557}
0 commit comments