Skip to content

Commit

Permalink
debug fix
Browse files Browse the repository at this point in the history
This fixes #117
`this._loading` is undefined/null if calling 'define()' directly, rather than via `load()`.
`exts` incorrectly being used in `this.types[exts]`. Since exts is an array, it only works if the array holds a single value.
  • Loading branch information
WORMSS authored May 10, 2017
1 parent 9515cda commit 2f1f6a0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mime.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Mime.prototype.define = function (map) {
for (var type in map) {
var exts = map[type];
for (var i = 0; i < exts.length; i++) {
if (process.env.DEBUG_MIME && this.types[exts]) {
console.warn(this._loading.replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' +
this.types[exts] + ' to ' + type);
if (process.env.DEBUG_MIME && this.types[exts[i]]) {
console.warn((this._loading || "define()").replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' +
this.types[exts[i]] + ' to ' + type);
}

this.types[exts[i]] = type;
Expand Down

0 comments on commit 2f1f6a0

Please sign in to comment.