https://github.com/bifravst/from-env
Helper function which ensures that required environment variables are set.
https://github.com/bifravst/from-env
iot nrf-asset-tracker
Last synced: 11 months ago
JSON representation
Helper function which ensures that required environment variables are set.
- Host: GitHub
- URL: https://github.com/bifravst/from-env
- Owner: bifravst
- License: bsd-3-clause
- Created: 2022-01-27T12:30:46.000Z (over 4 years ago)
- Default Branch: saga
- Last Pushed: 2025-07-19T10:44:36.000Z (11 months ago)
- Last Synced: 2025-07-19T11:27:26.292Z (11 months ago)
- Topics: iot, nrf-asset-tracker
- Language: TypeScript
- Homepage: https://github.com/bifravst/from-env#readme
- Size: 2.37 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# fromEnv [](https://www.npmjs.com/package/@bifravst/from-env)
[](https://github.com/bifravst/from-env/actions)
[](https://github.com/semantic-release/semantic-release)
[](https://renovatebot.com)
[](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional)
[](https://github.com/prettier/prettier/)
[](https://github.com/typescript-eslint/typescript-eslint)
Helper function which ensures that required environment variables are set.
## Example
```typescript
import { fromEnv } from "@bifravst/from-env";
const { env } = fromEnv({
env: "MY_ENV",
})(process.env);
```
This will throw an exception if `MY_ENV` is not set on `process.env`. Otherwise,
`env` will not contain the value of `process.env.MY_ENV`.
## Installation
npm i --save-dev --save-exact @bifravst/from-env
## Usage
See [`fromEnv.spec.ts`](./src/fromEnv.spec.ts).