@dolanites/utils
v1.0.1
Published
JavaScript utility packages bundled together
Downloads
10
Readme
@dolanites/utils.js
JavaScript utility methods/packages bundled together.
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
Roadmap
Additional string, number, base64 utilities support