Comments (3)
Hi @andys8 yea, I can see what you mean, though the link to TypeScript doesn't really matter here in general, as this is a JavaScript library, not a TypeScript library.
Is there a specific reason the API is designed as it is?
I don't think anyone is around these days from when this API decision was made, and I don't know exactly, so I unfortunately cannot provide you insight into that. Looking at the git
history, the API of returning false
is there since the very first commit: 1da5f79
Is it possible to bump major version and fix the signature regarding the amount of users?
It's possible, though unless there is a really good reason and someone is going to volunteer to pick up the torch and make pull requests and inform the community of this change, it seems too large to do at this point. The API of this module is just meant to mimic [email protected]
as a drop-in, especially now that mime
released 2.x with a completely different API.
1,262 public npm modules depend on the existing behavior and the constant updates to the mime database. Releasing a new major will immediately cut all those users off from further database updates until every module gets updated. I'm not sure how easy it will be to update with this type of API change, since it's a subtle change in the return value vs something like a function being removed.
Perhaps if someone can estimate what the usage of this API is out there we can form a conversation around the impact of the change, as otherwise, like it or not (I don't like the API), it's just now "part of the ecosystem" and not an easy rock to move.
from mime-types.
Closing due to no follow up response to continue discussion.
from mime-types.
I think the current api is not the best it could be, but popular public apis are very hard to change. Comparing the benefit and the potential damage due to breaking the API, I'm fine with closing the issue.
from mime-types.
Related Issues (20)
- Is it possible to get is image HOT 2
- Can I contribute the features from my fork? (TypeScript, Browser support, uses "exports") HOT 2
- Way to override `mime-db` HOT 4
- application/javascript should be replaced with text/javascript HOT 5
- CRA to Vite migration, process is not defined error in 'mime-types' package.
- Wrong Mime Type for .wav file
- Drop outdated node platforms from CI test matrix HOT 3
- Use `mime-score` to resolve extension conflicts.
- Broken tests for Node@8 and Node@9
- [Resolve Method] extname is not function, at lookup function (vite)
- lookup("map") returns "application/json" instead of false HOT 3
- Bump mime-db version up to the most recent one HOT 1
- New Version ETA HOT 12
- Remove "path" dependency from library HOT 11
- `image/svg+xml` charset HOT 1
- png with extension changed to jpg shows wrong mime type HOT 1
- Module not found: Error: Can't resolve 'path' in app/node_modules/mime-types HOT 4
- New release HOT 3
- ESM/browser support HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mime-types.