https://github.com/fabiospampinato/isoenv
A cross-platform Map-like interface for reading and writing environment variables.
https://github.com/fabiospampinato/isoenv
environment isomorphic variables
Last synced: 11 months ago
JSON representation
A cross-platform Map-like interface for reading and writing environment variables.
- Host: GitHub
- URL: https://github.com/fabiospampinato/isoenv
- Owner: fabiospampinato
- License: mit
- Created: 2024-05-19T19:01:36.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-09T22:56:47.000Z (about 2 years ago)
- Last Synced: 2024-08-11T11:58:20.374Z (almost 2 years ago)
- Topics: environment, isomorphic, variables
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# IsoEnv
A cross-platform Map-like interface for reading and writing environment variables.
If available it will use the `globalThis.process.env` object, otherwise it will use an internal object.
## Install
```sh
npm install isoenv
```
## Usage
```ts
import Env from 'isoenv';
// Set some environment variables
Env.set ( 'foo', 123 );
Env.set ( 'bar', '123' );
// Get some environment variables
Env.get ( 'foo' ); // '123'
Env.get ( 'bar' ); // '123'
Env.get ( 'baz' ); // undefined
// Delete some environment variables
Env.delete ( 'foo' );
// Check if an environment variable exists
Env.has ( 'foo' ); // false
Env.has ( 'bar' ); // true
```
## License
MIT © Fabio Spampinato