rsdoiel/mimetype-js

rename window.MimeType?

Closed this issue · 2 comments

I would like to use this lib in the browser but, while I can't find any documentation on it, it appears that Chrome already has a native constructor named MimeType. (Can Anyone confirm the MimeType constructor in Chrome?) A possible solution would be to change #L749 to `self.mimeType = MimeType. Seams appropriate since your MimeType object is in fact not a constructor.

}

I wrote this ages ago and have zero idea about how it may have been used in the past (other than some toy stuff I built at the time). I don't like the idea of colliding with window.MimeType. That seems very bad. How about something like

if (self.MimeType === undefined) {
self.MimeType = MimeType;
} else {
self.mimeType = MimeType;
}

Would that work for you?

Happy Holidays,

Robert

I have added if default to avoid windows.MimeType and add support to transition to window.mimeType.