utils
Javascript utils for server and client projects
config
const config = require('@marcopeg/utils/lib/config)
// will trigger an error if the env variable is not defined
const serverPort = config.get('SERVER_PORT')
// will return a default vailue if the env variable is not defined
const appName = config.get('APP_NAME', 'Default App Name')
// (process.env.NODE_ENV === 'development')
if (config.isDev()) {
...
}
pause
const pause = require('@marcopeg/utils/lib/pause)
async function foo () {
console.log('before')
await pause(2000) // stop process for 2s
console.log('after')
}
getErrorOrigin
Improve errors stack trace