read-env-value
Read env with default value
Last updated a year ago by GitHub Actions .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install read-env-value 
SYNC missed versions from official npm registry.

read-env-value

NPM Version NPM Downloads NPM License JSR JSR Score codecov GitHub Workflow Status PRs Welcome CodeRabbit Pull Request Reviews

Read env with default value

Usage

import { env } from 'read-env-value';

// read env 'NODE_ENV' with default value 'development'
const value = env('NODE_ENV', 'string', 'development');

API

env(key: string, type: 'string' | 'number' | 'boolean', defaultValue?: string | number | boolean)

Parameters

  • key: The environment variable key to read.
  • type: The type of the value to be returned.
  • defaultValue: The default value to return if the environment variable is not set.

Returns

  • The value of the environment variable.

Example

import { env } from 'read-env-value';

const value = env('NODE_ENV', 'string', 'development');

License

MIT

Contributors

Contributors

Made with contributors-img.

Current Tags

  • 2.0.2                                ...           latest (a year ago)

7 Versions

  • 2.0.2                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Total 13
Today 0
This Week 0
This Month 7
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (9)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE