Skip to content
Myr

Removed anonymous func for scoping

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 50cb104 · Browse files · 1 file+189 added−193 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+189 added−193 removed

  • other:+189 added−193 removed

1 file+189 added−193 removed

modified:lib/express.mime.js+189 added-193 removed
12// Express - Mime - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)34(function(){4Express.Mime = {5 name : 'mime',6 6 Express.Mime = {7 name : 'mime',7 settings : {8 defaultType : 'application/octet-stream'9 },10 11 utilities : {12 9 settings : {10 defaultType : 'application/octet-stream'13 /**14 * Returns the media type of _ext_, where _ext_ may be an15 * extension ('jpeg') or a file path ('path/to/image.name.jpeg'). 16 * Defaults to Express.settings.mime.defaultType.17 *18 * @param {string} ext19 * @return {string}20 * @api public21 */22 23 mime : function(ext) {24 if (ext.indexOf('.') != -1) 25 ext = ext.substring(ext.lastIndexOf('.') + 1, ext.length)26 return Express.utilities.mimeTypes[ext] || Express.settings.mime.defaultType27 28 },29 13 utilities : {14 15 /**16 * Returns the media type of _ext_, where _ext_ may be an17 * extension ('jpeg') or a file path ('path/to/image.name.jpeg'). 18 * Defaults to Express.settings.mime.defaultType.19 *20 * @param {string} ext21 * @return {string}22 * @api public23 */24 25 mime : function(ext) {26 if (ext.indexOf('.') != -1) 27 ext = ext.substring(ext.lastIndexOf('.') + 1, ext.length)28 return Express.utilities.mimeTypes[ext] || Express.settings.mime.defaultType29 30 },31 32 mimeTypes : {33 "3gp" : "video/3gpp",34 "a" : "application/octet-stream",35 "ai" : "application/postscript",36 "aif" : "audio/x-aiff",37 "aiff" : "audio/x-aiff",38 "asc" : "application/pgp-signature",39 "asf" : "video/x-ms-asf",40 "asm" : "text/x-asm",41 "asx" : "video/x-ms-asf",42 "atom" : "application/atom+xml",43 "au" : "audio/basic",44 "avi" : "video/x-msvideo",45 "bat" : "application/x-msdownload",46 "bin" : "application/octet-stream",47 "bmp" : "image/bmp",48 "bz2" : "application/x-bzip2",49 "c" : "text/x-c",50 "cab" : "application/vnd.ms-cab-compressed",51 "cc" : "text/x-c",52 "chm" : "application/vnd.ms-htmlhelp",53 "class" : "application/octet-stream",54 "com" : "application/x-msdownload",55 "conf" : "text/plain",56 "cpp" : "text/x-c",57 "crt" : "application/x-x509-ca-cert",58 "css" : "text/css",59 "csv" : "text/csv",60 "cxx" : "text/x-c",61 "deb" : "application/x-debian-package",62 "der" : "application/x-x509-ca-cert",63 "diff" : "text/x-diff",64 "djv" : "image/vnd.djvu",65 "djvu" : "image/vnd.djvu",66 "dll" : "application/x-msdownload",67 "dmg" : "application/octet-stream",68 "doc" : "application/msword",69 "dot" : "application/msword",70 "dtd" : "application/xml-dtd",71 "dvi" : "application/x-dvi",72 "ear" : "application/java-archive",73 "eml" : "message/rfc822",74 "eps" : "application/postscript",75 "exe" : "application/x-msdownload",76 "f" : "text/x-fortran",77 "f77" : "text/x-fortran",78 "f90" : "text/x-fortran",79 "flv" : "video/x-flv",80 "for" : "text/x-fortran",81 "gem" : "application/octet-stream",82 "gemspec" : "text/x-script.ruby",83 "gif" : "image/gif",84 "gz" : "application/x-gzip",85 "h" : "text/x-c",86 "hh" : "text/x-c",87 "htm" : "text/html",88 "html" : "text/html",89 "ico" : "image/vnd.microsoft.icon",90 "ics" : "text/calendar",91 "ifb" : "text/calendar",92 "iso" : "application/octet-stream",93 "jar" : "application/java-archive",94 "java" : "text/x-java-source",95 "jnlp" : "application/x-java-jnlp-file",96 "jpeg" : "image/jpeg",97 "jpg" : "image/jpeg",98 "js" : "application/javascript",99 "json" : "application/json",100 "log" : "text/plain",101 "m3u" : "audio/x-mpegurl",102 "m4v" : "video/mp4",103 "man" : "text/troff",104 "mathml" : "application/mathml+xml",105 "mbox" : "application/mbox",106 "mdoc" : "text/troff",107 "me" : "text/troff",108 "mid" : "audio/midi",109 "midi" : "audio/midi",110 "mime" : "message/rfc822",111 "mml" : "application/mathml+xml",112 "mng" : "video/x-mng",113 "mov" : "video/quicktime",114 "mp3" : "audio/mpeg",115 "mp4" : "video/mp4",116 "mp4v" : "video/mp4",117 "mpeg" : "video/mpeg",118 "mpg" : "video/mpeg",119 "ms" : "text/troff",120 "msi" : "application/x-msdownload",121 "odp" : "application/vnd.oasis.opendocument.presentation",122 "ods" : "application/vnd.oasis.opendocument.spreadsheet",123 "odt" : "application/vnd.oasis.opendocument.text",124 "ogg" : "application/ogg",125 "p" : "text/x-pascal",126 "pas" : "text/x-pascal",127 "pbm" : "image/x-portable-bitmap",128 "pdf" : "application/pdf",129 "pem" : "application/x-x509-ca-cert",130 "pgm" : "image/x-portable-graymap",131 "pgp" : "application/pgp-encrypted",132 "pkg" : "application/octet-stream",133 "pl" : "text/x-script.perl",134 "pm" : "text/x-script.perl-module",135 "png" : "image/png",136 "pnm" : "image/x-portable-anymap",137 "ppm" : "image/x-portable-pixmap",138 "pps" : "application/vnd.ms-powerpoint",139 "ppt" : "application/vnd.ms-powerpoint",140 "ps" : "application/postscript",141 "psd" : "image/vnd.adobe.photoshop",142 "py" : "text/x-script.python",143 "qt" : "video/quicktime",144 "ra" : "audio/x-pn-realaudio",145 "rake" : "text/x-script.ruby",146 "ram" : "audio/x-pn-realaudio",147 "rar" : "application/x-rar-compressed",148 "rb" : "text/x-script.ruby",149 "rdf" : "application/rdf+xml",150 "roff" : "text/troff",151 "rpm" : "application/x-redhat-package-manager",152 "rss" : "application/rss+xml",153 "rtf" : "application/rtf",154 "ru" : "text/x-script.ruby",155 "s" : "text/x-asm",156 "sgm" : "text/sgml",157 "sgml" : "text/sgml",158 "sh" : "application/x-sh",159 "sig" : "application/pgp-signature",160 "snd" : "audio/basic",161 "so" : "application/octet-stream",162 "svg" : "image/svg+xml",163 "svgz" : "image/svg+xml",164 "swf" : "application/x-shockwave-flash",165 "t" : "text/troff",166 "tar" : "application/x-tar",167 "tbz" : "application/x-bzip-compressed-tar",168 "tcl" : "application/x-tcl",169 "tex" : "application/x-tex",170 "texi" : "application/x-texinfo",171 "texinfo" : "application/x-texinfo",172 "text" : "text/plain",173 "tif" : "image/tiff",174 "tiff" : "image/tiff",175 "torrent" : "application/x-bittorrent",176 "tr" : "text/troff",177 "txt" : "text/plain",178 "vcf" : "text/x-vcard",179 "vcs" : "text/x-vcalendar",180 "vrml" : "model/vrml",181 "war" : "application/java-archive",182 "wav" : "audio/x-wav",183 "wma" : "audio/x-ms-wma",184 "wmv" : "video/x-ms-wmv",185 "wmx" : "video/x-ms-wmx",186 "wrl" : "model/vrml",187 "wsdl" : "application/wsdl+xml",188 "xbm" : "image/x-xbitmap",189 "xhtml" : "application/xhtml+xml",190 "xls" : "application/vnd.ms-excel",191 "xml" : "application/xml",192 "xpm" : "image/x-xpixmap",193 "xsl" : "application/xml",194 "xslt" : "application/xslt+xml",195 "yaml" : "text/yaml",196 "yml" : "text/yaml",197 "zip" : "application/zip"30 mimeTypes : {31 "3gp" : "video/3gpp",32 "a" : "application/octet-stream",33 "ai" : "application/postscript",34 "aif" : "audio/x-aiff",35 "aiff" : "audio/x-aiff",36 "asc" : "application/pgp-signature",37 "asf" : "video/x-ms-asf",38 "asm" : "text/x-asm",39 "asx" : "video/x-ms-asf",40 "atom" : "application/atom+xml",41 "au" : "audio/basic",42 "avi" : "video/x-msvideo",43 "bat" : "application/x-msdownload",44 "bin" : "application/octet-stream",45 "bmp" : "image/bmp",46 "bz2" : "application/x-bzip2",47 "c" : "text/x-c",48 "cab" : "application/vnd.ms-cab-compressed",49 "cc" : "text/x-c",50 "chm" : "application/vnd.ms-htmlhelp",51 "class" : "application/octet-stream",52 "com" : "application/x-msdownload",53 "conf" : "text/plain",54 "cpp" : "text/x-c",55 "crt" : "application/x-x509-ca-cert",56 "css" : "text/css",57 "csv" : "text/csv",58 "cxx" : "text/x-c",59 "deb" : "application/x-debian-package",60 "der" : "application/x-x509-ca-cert",61 "diff" : "text/x-diff",62 "djv" : "image/vnd.djvu",63 "djvu" : "image/vnd.djvu",64 "dll" : "application/x-msdownload",65 "dmg" : "application/octet-stream",66 "doc" : "application/msword",67 "dot" : "application/msword",68 "dtd" : "application/xml-dtd",69 "dvi" : "application/x-dvi",70 "ear" : "application/java-archive",71 "eml" : "message/rfc822",72 "eps" : "application/postscript",73 "exe" : "application/x-msdownload",74 "f" : "text/x-fortran",75 "f77" : "text/x-fortran",76 "f90" : "text/x-fortran",77 "flv" : "video/x-flv",78 "for" : "text/x-fortran",79 "gem" : "application/octet-stream",80 "gemspec" : "text/x-script.ruby",81 "gif" : "image/gif",82 "gz" : "application/x-gzip",83 "h" : "text/x-c",84 "hh" : "text/x-c",85 "htm" : "text/html",86 "html" : "text/html",87 "ico" : "image/vnd.microsoft.icon",88 "ics" : "text/calendar",89 "ifb" : "text/calendar",90 "iso" : "application/octet-stream",91 "jar" : "application/java-archive",92 "java" : "text/x-java-source",93 "jnlp" : "application/x-java-jnlp-file",94 "jpeg" : "image/jpeg",95 "jpg" : "image/jpeg",96 "js" : "application/javascript",97 "json" : "application/json",98 "log" : "text/plain",99 "m3u" : "audio/x-mpegurl",100 "m4v" : "video/mp4",101 "man" : "text/troff",102 "mathml" : "application/mathml+xml",103 "mbox" : "application/mbox",104 "mdoc" : "text/troff",105 "me" : "text/troff",106 "mid" : "audio/midi",107 "midi" : "audio/midi",108 "mime" : "message/rfc822",109 "mml" : "application/mathml+xml",110 "mng" : "video/x-mng",111 "mov" : "video/quicktime",112 "mp3" : "audio/mpeg",113 "mp4" : "video/mp4",114 "mp4v" : "video/mp4",115 "mpeg" : "video/mpeg",116 "mpg" : "video/mpeg",117 "ms" : "text/troff",118 "msi" : "application/x-msdownload",119 "odp" : "application/vnd.oasis.opendocument.presentation",120 "ods" : "application/vnd.oasis.opendocument.spreadsheet",121 "odt" : "application/vnd.oasis.opendocument.text",122 "ogg" : "application/ogg",123 "p" : "text/x-pascal",124 "pas" : "text/x-pascal",125 "pbm" : "image/x-portable-bitmap",126 "pdf" : "application/pdf",127 "pem" : "application/x-x509-ca-cert",128 "pgm" : "image/x-portable-graymap",129 "pgp" : "application/pgp-encrypted",130 "pkg" : "application/octet-stream",131 "pl" : "text/x-script.perl",132 "pm" : "text/x-script.perl-module",133 "png" : "image/png",134 "pnm" : "image/x-portable-anymap",135 "ppm" : "image/x-portable-pixmap",136 "pps" : "application/vnd.ms-powerpoint",137 "ppt" : "application/vnd.ms-powerpoint",138 "ps" : "application/postscript",139 "psd" : "image/vnd.adobe.photoshop",140 "py" : "text/x-script.python",141 "qt" : "video/quicktime",142 "ra" : "audio/x-pn-realaudio",143 "rake" : "text/x-script.ruby",144 "ram" : "audio/x-pn-realaudio",145 "rar" : "application/x-rar-compressed",146 "rb" : "text/x-script.ruby",147 "rdf" : "application/rdf+xml",148 "roff" : "text/troff",149 "rpm" : "application/x-redhat-package-manager",150 "rss" : "application/rss+xml",151 "rtf" : "application/rtf",152 "ru" : "text/x-script.ruby",153 "s" : "text/x-asm",154 "sgm" : "text/sgml",155 "sgml" : "text/sgml",156 "sh" : "application/x-sh",157 "sig" : "application/pgp-signature",158 "snd" : "audio/basic",159 "so" : "application/octet-stream",160 "svg" : "image/svg+xml",161 "svgz" : "image/svg+xml",162 "swf" : "application/x-shockwave-flash",163 "t" : "text/troff",164 "tar" : "application/x-tar",165 "tbz" : "application/x-bzip-compressed-tar",166 "tcl" : "application/x-tcl",167 "tex" : "application/x-tex",168 "texi" : "application/x-texinfo",169 "texinfo" : "application/x-texinfo",170 "text" : "text/plain",171 "tif" : "image/tiff",172 "tiff" : "image/tiff",173 "torrent" : "application/x-bittorrent",174 "tr" : "text/troff",175 "txt" : "text/plain",176 "vcf" : "text/x-vcard",177 "vcs" : "text/x-vcalendar",178 "vrml" : "model/vrml",179 "war" : "application/java-archive",180 "wav" : "audio/x-wav",181 "wma" : "audio/x-ms-wma",182 "wmv" : "video/x-ms-wmv",183 "wmx" : "video/x-ms-wmx",184 "wrl" : "model/vrml",185 "wsdl" : "application/wsdl+xml",186 "xbm" : "image/x-xbitmap",187 "xhtml" : "application/xhtml+xml",188 "xls" : "application/vnd.ms-excel",189 "xml" : "application/xml",190 "xpm" : "image/x-xpixmap",191 "xsl" : "application/xml",192 "xslt" : "application/xslt+xml",193 "yaml" : "text/yaml",194 "yml" : "text/yaml",195 "zip" : "application/zip"198 }196 }197 }201 202})()198}