Tiny utility functions
npm install @therockstorm/utils --save
Calls console.log
utils.log('My message')
Calls console.debug
with [debug]
prefix
utils.debug('My message')
Calls console.info
with [info]
prefix
utils.info('My message')
Calls console.warn
with [warn]
prefix
utils.warn('My message')
Calls console.error
with [error]
prefix
utils.error('My message')
Returns argument from process.env
or throws if undefined
const value = utils.envVar('MY_KEY')
Returns first argument or throws using second argument as error message if undefined
const value = utils.required(process.argv[1], 'myOption')
Throws an exception, can be used in locations throw
cannot
myVal ? doSomething() : thrw('error')
# Install dependencies
nvm install && nvm use && npm install
# Run tests
npm test
MIT © Rocky Warren