Socket
Socket
Sign inDemoInstall

confi-helpers

Package Overview
Dependencies
1
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    confi-helpers

template helpers for firstandthird/confi


Version published
Maintainers
2
Install size
23.9 kB
Created

Readme

Source

Confi Helpers

Test Status Lint Status

Confi Helpers is not designed to be used directly. It is used by Confi.

Helpers:

exists(name)

Checks if a var is set.

  • name - name of the variable to check.

Returns: boolean

getEnv(name, [fallback])

Gets an environment variable.

  • name - the environment variable to grab.
  • fallback - a fallback value to use if the environment variable is not set.

Returns: string - Value of environment variable or thrown error if name doesn't exist and no fallback provided.

getEnvInt(name, [fallback])

Gets an environment variable.

  • name - the environment variable to grab.
  • fallback - a fallback value to use if the environment variable is not set.

Returns: int - Value of environment variable, casted to an integer or thrown error if name doesn't exist and no fallback provided.

getEnvOrFilename(name)

Reads a file or returns value of an environment variable.

  • name - Name of the environment variable.

Returns: string - Contents of a file or value of the environment variable. If variable not found error will be thrown.

hasValue(value)

Checks if a passed variable has a value and isn't null, undefined, or empty.

Note: Arrays and objects are not checked.

  • value - Passed variable to check.

Returns: boolean

readFile(name)

Checks if a passed variable has a value and isn't null, undefined, or empty.

Note: Arrays and objects are not checked.

  • name - Filename

Returns: string File contents.

truthy(value, [fallback])

Checks if a value is truthy.

  • value - value to check.
  • fallback - defaults to false

Returns: boolean

truthyEnv(name, [fallback])

Checks if an environment variable is truthy.

  • value - name of the environment variable.
  • fallback - defaults to false

Returns: boolean

ms(value)

Converts a value to milliseconds. Uses the ms package.

  • value - value to convert.

Returns: mixed


A First + Third Project

Keywords

FAQs

Last updated on 06 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc