Skip to content

Commit

Permalink
fix: fix #192
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa committed Apr 11, 2018
1 parent 0431158 commit 5c35df6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Mime.js
Expand Up @@ -41,7 +41,6 @@ Mime.prototype.define = function(typeMap, force) {
// '*' prefix = not the preferred type for this extension. So fixup the
// extension, and skip it.
if (ext[0] == '*') {
extensions[i] = ext.substr(1);
continue;
}

Expand All @@ -59,7 +58,8 @@ Mime.prototype.define = function(typeMap, force) {

// Use first extension as default
if (force || !this._extensions[type]) {
this._extensions[type] = extensions[0];
var ext = extensions[0];
this._extensions[type] = (ext[0] != '*') ? ext : ext.substr(1)
}
}
};
Expand Down
6 changes: 6 additions & 0 deletions src/test.js
Expand Up @@ -6,6 +6,12 @@ var assert = require('assert');
var chalk = require('chalk');

describe('class Mime', function() {
it('mime and mime/lite coexist', function() {
assert.doesNotThrow(function() {
require('../lite');
});
});

it('new constructor()', function() {
var Mime = require('../Mime');

Expand Down

0 comments on commit 5c35df6

Please sign in to comment.