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.
- Host: GitHub
- URL: https://github.com/stevemao/force-num
- Owner: stevemao
- Created: 2020-02-05T11:48:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-12T05:19:46.000Z (over 5 years ago)
- Last Synced: 2025-01-20T16:05:50.925Z (9 months ago)
- Topics: env-vars, environment-variables, environment-vars
- Language: TypeScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
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.