Home Reference Source Repository
import Ensure from 'wyst/es6/utils/Ensure.js'
public class | source

Ensure

|| Ensure.throws this makes sure that process.exit(1) happens because something is wrong with our environment

Static Method Summary

Static Public Methods
public static

env(key: <type>): *

checks to ensure an environment variable is set

public static

error(msg: <type>)

generates an error with msg and throws it

public static

makes sure a given executable/bin can be found in our environment

public static

throws(err: <type>)

throws

Static Public Methods

public static env(key: <type>): * source

checks to ensure an environment variable is set

Params:

NameTypeAttributeDescription
key <type>

The environment variable to check for

Return:

*

public static error(msg: <type>) source

generates an error with msg and throws it

Params:

NameTypeAttributeDescription
msg <type>

The msg

public static executable(exe: String): String source

makes sure a given executable/bin can be found in our environment

Params:

NameTypeAttributeDescription
exe String

The executable we need

Return:

String

the path where the executable lives

public static throws(err: <type>) source

throws

Params:

NameTypeAttributeDescription
err <type>

The err

Example:

const required_value = config.thing || Ensure.throws(`missing config.thing`)