Skip to content

Alias to console.log that simplifies and optimizes the logs 🌠

License

Notifications You must be signed in to change notification settings

DanielVenturini/cnlg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cnlg

Simplify and optimize your console.log.

Getting Started

Install the package using npm:

npm install cnlg --save-dev

Usage

All parameters in cnlg must be passed like an object:

cnlg({a, b, c})

Example

If you want print the variables like this:

var a = 'my string'
var b = 123
var c = 'my another string'
var d = {key1: 'mapped1'}

// slowly code
console.log('a: ' + a) // a: my string
console.log('b: ' + b) // b: 123
console.log('c: ' + c) // c: my another string
console.log('d: ' + d) // d: [object Object]

you can just do the same with cnlg:

const cnlg = require('cnlg')
var a = 'my string'
var b = 123
var c = 'my another string'
var d = {key1: 'mapped1'}

cnlg({a, b, c, d})
// a: my string
// b: 123
// c: my another string
// d: {"key1":"mapped1"}

you also can break lines between the variables:

cnlg({a, b}, {d})
// a: my string
// b: 123
//
// d: {"key1":"mapped1"}

Compatibility

It runs on

Node Works
v0.x - v1.x ⚠️
v2.x - latest (v12) ✔️

It doesn't work in Node.Js 0.x and io.js 1.x because it expects a key followed by a mapping:

cnlg({a:a, b:b, c:c})