status(n) returns n if n is a number
Closed this issue · 5 comments
The readme states
status(403) // => 'Forbidden'
status('403') // => 'Forbidden'
But true output is
status(403) // => 403
status('403') // => 403
not sure what is expected behavior. under the hood, all it's doing is:
status[403] // => 403
status['403'] // => 403
not sure it's worth the complexity
No, it does not. Look at lines 41-44 in index.js
It checks if status[code]
is truly, and then returns code
.
I would expect it to return status[code]
instead of just code
.
ah ok. read the issue wrong. i swear your issue stated that status(403)
and status('403')
returned different output before, but i am also sick right now...
The description above the examples asserted the same as the code: the return value is the code. In this case, the examples were just incorrect.
I think it may make sense to have a function that takes the number and returns the name so you don't have to use the exported map, though.