1.0.6 • Published 3 years ago

@dolanites/utils.js v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@dolanites/utils.js

JavaScript utility methods/packages bundled together.

API Documentation

API Documentation

Installation

Install @dolanites/utils.js with npm

  yarn add @dolanites/utils.js  
  // npm i @dolanites/utils.js

Usage/Examples

import { env, wait, Logger } from '@dolanites/utils.js'

env

console.log(env.node_env) // prints current value for NODE_ENV

// get env variable from process.env
const SERVER_PORT = env.number('SERVER_PORT', 5432);
const SERVER_HOST = env.string('SERVER_HOST', 'localhost');

wait

const create = async (ctx) => {
    ...
    await wait.miliseconds(); // wait.waitForMs()
    await wait.seconds() // wait.waitForSeconds()
    await wait.tick() // wait.nextTick()
    ...
}

Logger

const logger = new Logger()
logger.log.info('Hello World')
logger.log.warn('This is a warning')
logger.log.error('Error log')
logger.log.fatal('Error/Fatal log')

License

MIT

Roadmap

  • Additional string, number, base64 utilities support

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago