type-is
3.0.0 · 21 Sep 2026MIT211.4M / weekRepositoryHomepagenpmAtom feed
Where each line stands
Plan an upgradeLatest releases
All 41 releases- 3.x · latest line
3.0.0
21 Sep 2026Publish the package as ESM and bump to node 22 (#106)
Publishes built-in types using TypeScript (#94)
Refactors the API shape to a class (#103)
This version switches the package to ESM and node >= 22.
Changed:
Publish the package as ESM and bump to node 22 (#106)
Publishes built-in types using TypeScript (#94)
Refactors the API shape to a class (#103)
2-4x faster by initializing the class once (instead of every request)
20% faster by initializing inline (e.g. every request)
Added support for matching parameters too (e.g.
text/html; charset=utf-8)Returns the original input string not the matched MIME type
Previously
text/*would return e.g.text/htmlon match, now it returns the originaltext/*
Returns
undefinedinstead offalseon no matchReturns
undefinedwhen no input types are definedThrows on invalid MIME type used to construct the matcher (e.g.
new TypeIs(["invalid"]), it does not error if the header is invalid)
Matches return the original input string (#109)
Removed:
Removes
mime-typesfrom the package, only has 3 built in "shortcuts" (e.g.json->application/json)Pass
mime-types.lookupas an option to override
Before:
const isText = typeis(req, ['text/*'])
After:
const isText = new TypeIs(['text/*']).request(req);
If you are upgrading an upstream dependency (e.g. express), and want maximum compatibility, something like this can help with compatibility for the extension aliases:
import * as mimeTypes from 'mime-types'; import { TypeIs, DEFAULT_LOOKUP } from 'type-is'; function lookup (value) { return mimeTypes.lookup(value) || DEFAULT_LOOKUP(value); } req.is = function (types) { const matcher = new TypeIs(types, { lookup }); return matcher.request(this); };However the returned string has changed. Backward compatibility with the old string is achievable by mimicking the old behavior -- parse the MIME type yourself (example) and use the
matcher.contentTypemethod. This is not recommended though.- 2.x · maintenance
2.1.0
13 May 20262.0.1
27 Mar 2025
Notes older than 90 days are read on the Releases tab.
Dependency tracking · free for 3 projects
Know when your own dependencies move
type-is shipped a new major in the last 12 months, among 2 releases. inlinr shows which of your projects are behind, and what the upgrade breaks.
Advisories reach you
An email when a critical or high advisory affects a project, before the next install.
Upgrades checked first
Peer ranges, Node, ESM-only and types changes read before you bump.
Only what matters
Majors and breaking notes stay; patches and sibling bumps fold into one line.
Reading releases, release notes and advisories…
Registry facts last checked 3 Nov 2026. Releases and advisories last read 3 Nov 2026.