https://github.com/ambar/match-env
https://github.com/ambar/match-env
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ambar/match-env
- Owner: ambar
- License: mit
- Created: 2022-11-24T16:12:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-03T09:13:04.000Z (over 1 year ago)
- Last Synced: 2025-02-03T07:19:44.834Z (4 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# match-env
Use an inline JavaScript expression to test environment variables.
## Install
```bash
npm install match-env --save-dev
# Or
yarn add match-env --dev
```## Usage
### Detection Mode
```bash
match-env "NODE_ENV=='test' && BUILD_TARGET!='node'" && echo yes || echo no# build or noop
match-env 'CI==`true`' && yarn build || ':'# handle `undefined`, same as `(process.env.FOO || globalThis.FOO)==`
match-env 'FOO==1' && yarn build || ':'
```### Call Mode
```bash
match-env 'FOO==1' -- yarn build
```