Install: npm i @darius-kiuberis/helper
Use: import {log, random, type} from '@darius-kiuberis/helper'
-
DESCRIPTION:
detects enviroment, logs only if "development".
-
EXAMPLE:
log(oneValue)
logs like console.log(oneValue)
-
EXAMPLE:
log(anything, this, and, this)
on every log adds number.
-
EXAMPLE:
log( { logConfig: {bold: true} }, value1, value2, value3, and, etc )
can customise logs by passing
logConfig
object.
here is available API:property value default browser node description ready production true false yes yes logs in production enviroment no/no indent 4 3 no yes indentation for objects (1-10) -/yes bold true false yes yes bold text no/yes blink true false yes yes text is blinking no/no bright true false yes yes text is bright no/no bgColor 'black', 'blue', 'green', 'pink' 'purple' yes yes background color no/yes 'red', 'yellow', 'aqua', white' bgRandom true false yes yes random background color no/no dim true false yes yes text is dimmed no/no textColor 'black', 'blue', 'green', 'pink' 'white' yes yes text color no/yes 'red', 'yellow', 'aqua', white' underscore true false yes yes list number underscore no/yes numbers true false yes yes list number no/yes numbersRandom true false yes yes random list number (1-999) no/yes
-
DESCRIPTION:
returns random characters
-
EXAMPLE:
random({type: "char", length: 55, inlude: {special: true}})
can customise random by passing
{}
object.
here is available API:type options suboptions default description ready "char" length: number 9 creates random characters (string) no upper: boolean false no include: object number: boolean false no special: boolean false no "number" length: number 3 how long is number (if length: 4; then XXXX) no min: number 0 no max: number 99 no decimal: boolean false no no no
[TOC]
- EXAMPLE: type(any-value)
returns correct type of passed variable.
Husky: you can just write git commit -m "blah blah" -n
NOTE: the -n
will get you bypass the hooks.
Starts the application in development using nodemon and ts-node to do cold reloading.
Builds the app at build, cleaning the folder first.
Starts the app in production by first building the project with npm run build, and then executing the compiled JavaScript at build/index.js
-
using
npm pack
:~/package-name $
npm run build
~/package-name $npm pack
~/package-name $cp darius-kiuberis/helper-0.0.0.tgz ~
~/workspace/some-application $npm install ~/darius-kiuberis/helper-0.0.0.tgz
-
using
yalc
(npm i yalc -g):- add:
~/package-name $
npm run prod
~/some-application $yalc add @darius-kiuberis/helper
- update:
~/package-name $
npm run prod
~/some-application $yalc update @darius-kiuberis/helper
~/some-application $CTRL + C && npm start
- remove:
~/some-application $
npm uninstal @darius-kiuberis/helper
~/some-application $yalc remove @darius-kiuberis/helper
- add: