getenv
npmv2.0.0Get and typecast environment variables.
Adopt with care
getenv is usable, with caveats. Last published 491 days ago.
- ?Adoption: grade ?, Not reported by this registry.
No download data reported for this package yet.
- CMaintenance: grade C, Fair — worth a look.
Last published 491 days ago.
- AWeight: grade A, Excellent.
Zero runtime dependencies, about 11 KB installed.
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
MIT — permissive, with no copyleft found in the dependency tree.
Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.
Install cost
What you actually take on by adding getenv to a project.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
Longest resolved dependency chain below this package.
Compatibility
- Node.js
- node >=6
- Module format
- CommonJS only
- TypeScript
- No bundled types
- Install scripts
- None
Quick start
A usage example from the getenv README.
const getenv = require('getenv');
const host = getenv('HTTP_HOST'); // same as getenv.string('HTTP_HOST');
const port = getenv.int('HTTP_PORT');
const start = getenv.bool('HTTP_START');
if (start === true) {
// const server = http.createServer();
// server.listen(port, host);
}
const abTestRatio = getenv.float('AB_TEST_RATIO');
if (Math.random() < abTestRatio) {getenv vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| getenvthis page | 0 | 7 | MIT | 1 year ago |
| strip-json-comments | 0 | 2 | MIT | 1 day ago |
| env-paths | 0 | 2 | MIT | 1 day ago |
| path-key | 244.9M | 1 | MIT | 1 day ago |
| cosmiconfig | 115.3M | 3 | MIT | 1 day ago |
| loose-envify | 65M | 2 | MIT | 1 day ago |
Dependencies
Declared by getenv v2.0.0. Runtime dependencies are installed with the package; dev dependencies are not.
Dev (1)
Used by
Popular packages that depend on getenv.
A library for interacting with the app.json
A library for Expo config plugins
The Expo CLI
A Metro config for running React Native projects with the Metro bundler
A library to generate a fingerprint from a React Native project
hydrate environment variables from .env files into process.env
A package used by Expo CLI for processing images
Relationship graph
Dependencies (left) and dependents (right) of getenv.
Frequently installed together
The Expo SDK
the most correct and second fastest glob implementation in JavaScript
Lightweight debugging utility for Node.js and the browser
The semantic version parser used by npm.
Reusable require and Node resolution utilities library for Expo
A Promise-based interface into processes created by child_process.spawn
A module for reading, writing, and manipulating JSON files
Expo Router is a file-based router for React Native and web applications.
TypeScript definitions for debug
Resolve the path of a module like `require.resolve()` but from a given path
hydrate environment variables from .env files into process.env
Slugifies a String
Release history
1 release in the last two years, typically about 395 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 2.0.0latest | 1 year ago | 11 KB | MIT |
| 1.0.0 | 7 years ago | 9.9 KB | MIT |
| 0.7.0 | 10 years ago | — | MIT |
| 0.6.0 | 10 years ago | — | MIT |
| 0.5.0 | 11 years ago | — | MIT |
| 0.4.0 | 11 years ago | — | MIT |
| 0.3.0 | 14 years ago | — | MIT |
| 0.2.0 | 14 years ago | — | MIT |
| 0.1.0 | 14 years ago | — | MIT |
Overview
getenv is an npm package that get and typecast environment variables. It has 7 known dependents in the graph. The latest version is 2.0.0, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need get and typecast environment variables and value a focused solution.
When not to use it
Consider an alternative if you need to have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.
Pros
- Clear open-source license (MIT).
- Lean dependency tree (1 direct dependencies).
Cons
- No bundled TypeScript types (may require a separate @types package).
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Frequently asked questions
Should I use getenv?
getenv is usable, with caveats. Last published 491 days ago.
How do I install getenv?
Run `npm install getenv` to add getenv to your npm project.
What license is getenv released under?
getenv is distributed under the MIT license.
How popular is getenv?
npm does not publish download counts. Within PackageGraph's crawl, 7 known packages depend on getenv.
Is getenv still maintained?
The most recent release of getenv (v2.0.0) was published 1 year ago.
Does getenv run install scripts?
No. getenv does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.