Comparing version
121
index.js
@@ -0,4 +1,10 @@ | ||
'use strict'; | ||
var chalk = require('chalk'); | ||
var m = { | ||
////////////////// | ||
// main methods // | ||
////////////////// | ||
// default | ||
@@ -12,10 +18,2 @@ d: function(msg) { | ||
}, | ||
// err | ||
e: function(msg) { | ||
if (typeof(msg) == 'object') { | ||
console.log(chalk.bgRed.white('\n' + JSON.stringify(msg, null, 2))); | ||
} else { | ||
console.log(chalk.bgRed.white(msg)); | ||
} | ||
}, | ||
// success | ||
@@ -37,2 +35,10 @@ s: function(msg) { | ||
}, | ||
// err | ||
e: function(msg) { | ||
if (typeof(msg) == 'object') { | ||
console.log(chalk.bgRed.white('\n' + JSON.stringify(msg, null, 2))); | ||
} else { | ||
console.log(chalk.bgRed.white(msg)); | ||
} | ||
}, | ||
// highlight | ||
@@ -46,4 +52,35 @@ h: function(msg) { | ||
}, | ||
// lines | ||
line: function(char = '-', length = 30) { | ||
//info | ||
i: function(msg) { | ||
if (typeof(msg) == 'object') { | ||
console.info(chalk.bold.cyan('\n' + JSON.stringify(msg, null, 2))); | ||
} else { | ||
console.info(chalk.bold.cyan(msg)); | ||
} | ||
}, | ||
//trace: | ||
t: function(msg) { | ||
if (typeof(msg) == 'object') { | ||
console.log(chalk.green("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< BEGIN")); | ||
console.trace(chalk.green('\n' + JSON.stringify(msg, null, 2))); | ||
console.log(chalk.green(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END\n")); | ||
} else { | ||
console.log(chalk.green("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< BEGIN")); | ||
console.trace(chalk.green(msg)); | ||
console.log(chalk.green(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END\n")); | ||
} | ||
}, | ||
/////////// | ||
// lines // | ||
/////////// | ||
// default | ||
line: function(char, length) { | ||
if(!char) { | ||
char = '-'; | ||
}; | ||
if(!length) { | ||
length = 30; | ||
}; | ||
if (typeof(char) == 'object') { | ||
@@ -54,3 +91,3 @@ this.e("ERROR: the line() function can't accept objects!"); | ||
if (length > 100) { | ||
// this.w("WARNING: Do you really need the line's length more than 100 ?"); | ||
// this.w("WARNING: "); | ||
} | ||
@@ -64,3 +101,10 @@ var theLine = ""; | ||
}, | ||
dline: function(char = '-', length = 30) { | ||
// default - another | ||
dline: function(char, length) { | ||
if(!char) { | ||
char = '-'; | ||
}; | ||
if(!length) { | ||
length = 30; | ||
}; | ||
if (typeof(char) == 'object') { | ||
@@ -71,3 +115,3 @@ this.e("ERROR: the line() functions can't accept objects!"); | ||
if (length > 100) { | ||
// this.w("WARNING: Do you really need the line's length more than 100 ?"); | ||
// this.w("WARNING: "); | ||
} | ||
@@ -81,3 +125,10 @@ var theLine = ""; | ||
}, | ||
eline: function(char = '-', length = 30) { | ||
// success | ||
sline: function(char, length) { | ||
if(!char) { | ||
char = '-'; | ||
}; | ||
if(!length) { | ||
length = 30; | ||
}; | ||
if (typeof(char) == 'object') { | ||
@@ -88,3 +139,3 @@ this.e("ERROR: the line() functions can't accept objects!"); | ||
if (length > 100) { | ||
// this.w("WARNING: Do you really need the line's length more than 100 ?"); | ||
// this.w("WARNING: "); | ||
} | ||
@@ -95,6 +146,13 @@ var theLine = ""; | ||
}; | ||
console.log(chalk.bgRed.white(theLine)); | ||
console.log(chalk.bold.green(theLine)); | ||
} | ||
}, | ||
wline: function(char = '-', length = 30) { | ||
// warning | ||
wline: function(char, length) { | ||
if(!char) { | ||
char = '-'; | ||
}; | ||
if(!length) { | ||
length = 30; | ||
}; | ||
if (typeof(char) == 'object') { | ||
@@ -105,3 +163,3 @@ this.e("ERROR: the line() functions can't accept objects!"); | ||
if (length > 100) { | ||
// this.w("WARNING: Do you really need the line's length more than 100 ?"); | ||
// this.w("WARNING: "); | ||
} | ||
@@ -115,3 +173,10 @@ var theLine = ""; | ||
}, | ||
sline: function(char = '-', length = 30) { | ||
// error | ||
eline: function(char, length) { | ||
if(!char) { | ||
char = '-'; | ||
}; | ||
if(!length) { | ||
length = 30; | ||
}; | ||
if (typeof(char) == 'object') { | ||
@@ -122,3 +187,3 @@ this.e("ERROR: the line() functions can't accept objects!"); | ||
if (length > 100) { | ||
// this.w("WARNING: Do you really need the line's length more than 100 ?"); | ||
// this.w("WARNING: "); | ||
} | ||
@@ -129,6 +194,13 @@ var theLine = ""; | ||
}; | ||
console.log(chalk.bold.green(theLine)); | ||
console.log(chalk.bgRed.white(theLine)); | ||
} | ||
}, | ||
hline: function(char = '-', length = 30) { | ||
// highlight | ||
hline: function(char, length) { | ||
if(!char) { | ||
char = '-'; | ||
}; | ||
if(!length) { | ||
length = 30; | ||
}; | ||
if (typeof(char) == 'object') { | ||
@@ -139,3 +211,3 @@ this.e("ERROR: the line() functions can't accept objects!"); | ||
if (length > 100) { | ||
// this.w("WARNING: Do you really need the line's length more than 100 ?"); | ||
// this.w("WARNING: "); | ||
} | ||
@@ -149,5 +221,4 @@ var theLine = ""; | ||
} | ||
}; | ||
} | ||
module.exports = m; |
{ | ||
"name": "lme", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "Simply and beautifully log to console.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "node test.js" | ||
}, | ||
@@ -18,3 +18,5 @@ "repository": { | ||
"beautiful", | ||
"output" | ||
"output", | ||
"console", | ||
"log" | ||
], | ||
@@ -29,3 +31,7 @@ "author": "Vajahath Ahmed <vajuoff.1@gmail.com> (http://twitter.com/vajahath7)", | ||
"chalk": "^1.1.3" | ||
} | ||
}, | ||
"contributors": [ | ||
"Aman Mittal (http://github.com/amandeepmittal)" | ||
] | ||
} |
@@ -12,2 +12,6 @@  | ||
> version 1.2.0 is out with more features and bug fixes. [Update](#install--update) to get most out of `lme`. See [change log](#change-log) for more details. | ||
## Why `lme` *( logme )* | ||
@@ -66,2 +70,4 @@ - Simpler to use than `console.log()` or even `console.log(chalk.red("hi"));` | ||
| `h` | highlight | for highlighting an output | `lme.h("hi");` | | ||
| `i` | info | for info like output | `lme.i("hi");` | | ||
| `t` | trace | for tracing stack | `lme.t("hi");` | | ||
@@ -120,15 +126,22 @@ <br> | ||
- v1.1.3 | ||
- **v1.2.0** | ||
+ Adds support for `trace`. | ||
+ Adds support for `info`. (*thanks [@amandeepmittal](https://github.com/amandeepmittal)*) | ||
+ Bug fixes | ||
* `line()` functions now support older versions of node. | ||
* Changed some colors for better accessibility on Windows and Linux machines. | ||
* Fixed some minor quirks. | ||
- **v1.1.3** | ||
+ bug fixes | ||
+ docs update | ||
- v1.1.2 | ||
- **v1.1.2** | ||
+ bug fixes | ||
+ docs update | ||
- v1.1.1 | ||
- **v1.1.1** | ||
+ bug fixes | ||
+ docs update | ||
- v1.1.0 | ||
- **v1.1.0** | ||
+ adds support for drawing lines | ||
+ docs update | ||
- versions < 1.1.0 | ||
- **versions < 1.1.0** | ||
+ adds support for semantic outputs. | ||
@@ -135,0 +148,0 @@ + bug fixes |
68
test.js
@@ -1,2 +0,4 @@ | ||
// sample tests | ||
////////////////// | ||
// sample tests // | ||
////////////////// | ||
/** | ||
@@ -11,22 +13,48 @@ | ||
lme.e({ya:"this", me:"ts"}); | ||
// objects | ||
lme.d({ kity: "is pinky", fluffy: "is funny!" }); | ||
lme.s({ kity: "is pinky", fluffy: "is funny!" }); | ||
lme.w({ kity: "is pinky", fluffy: "is funny!" }); | ||
lme.e({ kity: "is pinky", fluffy: "is funny!" }); | ||
lme.h({ kity: "is pinky", fluffy: "is funny!" }); | ||
lme.i({ kity: "is pinky", fluffy: "is funny!" }); | ||
lme.t({ kity: "is pinky", fluffy: "is funny!" }); | ||
lme.d('\n'); | ||
lme.w({ya:"this", me:"ts"}); | ||
lme.h({ya:"this", me:"ts"}); | ||
lme.s({ya:"this", me:"ts"}); | ||
lme.d({ya:"this", me:"ts"}); | ||
// strings | ||
lme.d('cherry is sweet!'); | ||
lme.s('cherry is sweet!'); | ||
lme.w('cherry is sweet!'); | ||
lme.e('cherry is sweet!'); | ||
lme.h('cherry is sweet!'); | ||
lme.i('cherry is sweet!'); | ||
lme.t('cherry is sweet!'); | ||
lme.d('\n'); | ||
lme.e('hello'); | ||
lme.w('hello'); | ||
lme.s('hello'); | ||
lme.d('hello'); | ||
lme.h('hello'); | ||
lme.d('\n'); | ||
// lme.line('*', 150); | ||
lme.dline('*',30); | ||
lme.line('*',12); | ||
lme.eline("#"); | ||
lme.wline({yu:1}); | ||
lme.sline("/"); | ||
lme.hline({"o":9}); | ||
// lme.eline({ye:"ki"}); | ||
// lines | ||
lme.line(); | ||
lme.line('*', 10); | ||
lme.dline(); | ||
lme.dline('*', 10); | ||
lme.sline(); | ||
lme.sline('*', 10); | ||
lme.wline(); | ||
lme.wline('*', 10); | ||
lme.eline(); | ||
lme.eline('*', 10); | ||
lme.hline(); | ||
lme.hline('*', 10); | ||
// error-ed outputs for lines | ||
lme.i("\nerror-ed outputs"); | ||
lme.line({ yu: 1 }); | ||
lme.dline({ yu: 1 }); | ||
lme.sline({ yu: 1 }); | ||
lme.wline({ yu: 1 }); | ||
lme.eline({ yu: 1 }); | ||
lme.hline({ yu: 1 }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
124452
0.57%249
15.81%0
-100%149
9.56%10
-9.09%1
Infinity%