@ionaru/node-utils
TypeScript icon, indicating that this package has built-in type declarations

0.0.0 • Public • Published

@ionaru/node-utils

npm version npm version Build Status codecov

Description

This package contains common Node.js utilities I use in my projects.

Usage

npm install @ionaru/node-utils

getEnvironmentVariable(key: string, defaultValue?: string): string

Returns the value of the environment variable key or defaultValue if the environment variable is not set. If defaultValue is undefined, the function will throw an error if the environment variable is not set.

import { getEnvironmentVariable } from '@ionaru/node-utils';

const envVar = getEnvironmentVariable('MY_ENV_VAR');
const envVarError = getEnvironmentVariable('MY_ENV_VAR'); // Errors with ""
const envVarWithDefault = getEnvironmentVariable('MY_ENV_VAR', 'default_value');

Readme

Keywords

none

Package Sidebar

Install

npm i @ionaru/node-utils

Weekly Downloads

1

Version

0.0.0

License

MIT

Unpacked Size

5.9 kB

Total Files

9

Last publish

Collaborators

  • ionaru