Skip to content

Commit 47bea8c

Browse files
authored
docs: updated usage (#55)
1 parent 68b0661 commit 47bea8c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ const { default: status } = require("http-status");
2626

2727
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.
2828

29-
For example, `status[418]` return `IM_A_TEAPOT` while `status.IM_A_TEAPOT` return `"I'm a teapot"` and `status.IM_A_TEAPOT_CODE` returns `418`.
29+
For example, the following will return \
30+
`status[418]` --> `"I'm a teapot"` \
31+
`status["418_NAME"]` --> `"IM_A_TEAPOT"` \
32+
`status["418_MESSAGE"]` --> `"Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY be short and stout."` . \
33+
`status["418_CLASS"]` --> `"4xx"` \
34+
`status.IM_A_TEAPOT` --> `418`
3035

3136
The package is written in TypeScript and built for CommonJS and ESM.
3237

0 commit comments

Comments
 (0)