decaffeinate: Convert CommandRunner.coffee and 25 other files to JS

This commit is contained in:
decaffeinate
2020-02-19 12:14:14 +01:00
committed by mserranom
parent 37794788ce
commit 4655768fd2
26 changed files with 2801 additions and 1964 deletions

View File

@@ -1,24 +1,28 @@
Path = require 'path'
let ContentTypeMapper;
const Path = require('path');
# here we coerce html, css and js to text/plain,
# otherwise choose correct mime type based on file extension,
# falling back to octet-stream
module.exports = ContentTypeMapper =
map: (path) ->
switch Path.extname(path)
when '.txt', '.html', '.js', '.css', '.svg'
return 'text/plain'
when '.csv'
return 'text/csv'
when '.pdf'
return 'application/pdf'
when '.png'
return 'image/png'
when '.jpg', '.jpeg'
return 'image/jpeg'
when '.tiff'
return 'image/tiff'
when '.gif'
return 'image/gif'
else
return 'application/octet-stream'
// here we coerce html, css and js to text/plain,
// otherwise choose correct mime type based on file extension,
// falling back to octet-stream
module.exports = (ContentTypeMapper = {
map(path) {
switch (Path.extname(path)) {
case '.txt': case '.html': case '.js': case '.css': case '.svg':
return 'text/plain';
case '.csv':
return 'text/csv';
case '.pdf':
return 'application/pdf';
case '.png':
return 'image/png';
case '.jpg': case '.jpeg':
return 'image/jpeg';
case '.tiff':
return 'image/tiff';
case '.gif':
return 'image/gif';
default:
return 'application/octet-stream';
}
}
});