Skip to content

v3.0.0

Latest

Choose a tag to compare

@blakeembrey blakeembrey released this 30 Nov 21:18
46db24a

Important: This package now ships as ESM and requires node >= 22.

Migrating from 2.x

import { codes, isEmpty, isRedirect, isRetry, message } from "statuses";
In 2.x In 3.x
status(404) or status.message[404] message[404]
status("404") Convert the input to a number before looking it up.
status("Not Found") or status.code["not found"] Use a numeric status code or maintain a reverse lookup in your application.
status.codes codes, typed as a readonly array. Copy it if you need to modify it.
status.empty[code] isEmpty(code)
status.redirect[code] isRedirect(code)
status.retry[code] isRetry(code)
  • Unknown numeric codes return undefined from message[code]. If you relied on status(code) throwing, check the result explicitly.
  • The predicates take numeric codes and return booleans. isRedirect(305) returns false.
  • Import from statuses directly. Package subpaths such as statuses/codes.json are no longer exported.
  • TypeScript projects can remove their direct @types/statuses dependency after upgrading.

Status code updates

  • Added 104 Upload Resumption Supported.
  • Updated 413 from "Payload Too Large" to "Content Too Large".
  • Updated 422 from "Unprocessable Entity" to "Unprocessable Content".

Full Changelog: v2.0.2...v3.0.0