@therockstorm/utils

3.0.21 • Public • Published

utils

npm Build Status license

Tiny utility functions

Installing

npm install @therockstorm/utils --save

API Reference

log

Calls console.log

utils.log('My message')

debug

Calls console.debug with [debug] prefix

utils.debug('My message')

info

Calls console.info with [info] prefix

utils.info('My message')

warn

Calls console.warn with [warn] prefix

utils.warn('My message')

error

Calls console.error with [error] prefix

utils.error('My message')

envVar

Returns argument from process.env or throws if undefined

const value = utils.envVar('MY_KEY')

required

Returns first argument or throws using second argument as error message if undefined

const value = utils.required(process.argv[1], 'myOption')

thrw

Throws an exception, can be used in locations throw cannot

myVal ? doSomething() : thrw('error')

Developing

# Install dependencies
nvm install && nvm use && npm install

# Run tests
npm test

License

MIT © Rocky Warren

Readme

Keywords

none

Package Sidebar

Install

npm i @therockstorm/utils

Weekly Downloads

3

Version

3.0.21

License

MIT

Unpacked Size

6.55 kB

Total Files

9

Last publish

Collaborators

  • therockstorm