</>PackageGraphPackageGraph

getenv

npmv2.0.0

Get 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.

0
Direct dependencies

Runtime packages this one declares itself.

0
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

11 KB
Install size

Unpacked size of this package plus its entire runtime tree.

Tree depth

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.

javascriptFull 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) {
Example truncated — see the full README.

getenv vs the alternatives

Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.

PackageWeekly downloadsDependentsLicenseLast release
getenvthis page07MIT1 year ago
strip-json-comments02MIT1 day ago
env-paths02MIT1 day ago
path-key244.9M1MIT1 day ago
cosmiconfig115.3M3MIT1 day ago
loose-envify65M2MIT1 day ago

Dependencies

Declared by getenv v2.0.0. Runtime dependencies are installed with the package; dev dependencies are not.

Used by

Popular packages that depend on getenv.

Relationship graph

Dependencies (left) and dependents (right) of getenv.

Frequently installed together

Release history

1 release in the last two years, typically about 395 days apart.

Recent versions of getenv
VersionPublishedSizeLicense
2.0.0latest1 year ago11 KBMIT
1.0.07 years ago9.9 KBMIT
0.7.010 years agoMIT
0.6.010 years agoMIT
0.5.011 years agoMIT
0.4.011 years agoMIT
0.3.014 years agoMIT
0.2.014 years agoMIT
0.1.014 years agoMIT

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

Keywords

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.