An open API service indexing awesome lists of open source software.

https://github.com/stevemao/force-num

Ensure environment variable exists and convert to a number. If not, throw to fail early.
https://github.com/stevemao/force-num

env-vars environment-variables environment-vars

Last synced: 8 months ago
JSON representation

Ensure environment variable exists and convert to a number. If not, throw to fail early.

Awesome Lists containing this project

README

          

> Ensure environment variable exists and convert to a number. If not, throw to fail early.

```ts
import forceNum from 'force-num'

const nodeEnv = forceNum('PORT')
// => 3000, or throw if not set or not a number
```

## Related

- [force-env](https://github.com/stevemao/force-env) - Ensure environment variable exists. If not, throw to fail early.