Skip to content

Commit 13417aa

Browse files
committed
docs: v2 migration
1 parent b962963 commit 13417aa

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: README.md

+20
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@
22

33
Utility to interact with HTTP status codes.
44

5+
## Migration to v2.x
6+
7+
Version 2 is a migration of the library to ESM modules and TypeScript. The API remains the same. The build system generates both ESM and CommonJS exports.
8+
9+
For ESM users, the import remains the same.
10+
11+
```js
12+
import status from "http-status";
13+
// Or
14+
import { status } from "http-status";
15+
```
16+
17+
For CommonJs users, update the `require` statement.
18+
19+
```js
20+
const { status } = require("http-status");
21+
// Or
22+
const { default: status } = require("http-status");
23+
```
24+
525
## Usage
626

727
Once you import or require this module, you may call it with either an HTTP code or a status name. With an HTTP code, you will get the status name while with a status name you will get an HTTP code or some complementary information.

0 commit comments

Comments
 (0)