Comparing version
{ | ||
"name": "qlt", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Quick logging tool", | ||
@@ -5,0 +5,0 @@ "main": "qlt.js", |
21
qlt.js
@@ -27,32 +27,33 @@ /* | ||
var EOL = require('os').EOL; | ||
var out = process.stdout; | ||
Number.prototype.__defineGetter__('log', function() { | ||
process.stdout.write(this.toString()); | ||
out.write(this.toString()); | ||
}); | ||
Number.prototype.__defineGetter__('logn', function() { | ||
process.stdout.write(this.toString()+EOL); | ||
out.write(this.toString()+EOL); | ||
}); | ||
String.prototype.__defineGetter__('log', function() { | ||
process.stdout.write(this.valueOf()); | ||
out.write(this.valueOf()); | ||
}); | ||
String.prototype.__defineGetter__('logn', function() { | ||
process.stdout.write(this.valueOf()+EOL); | ||
out.write(this.valueOf()+EOL); | ||
}); | ||
Array.prototype.__defineGetter__('log', function() { | ||
process.stdout.write('['+this.toString()+']'); | ||
out.write('['+this.toString()+']'); | ||
}); | ||
Array.prototype.__defineGetter__('logn', function() { | ||
process.stdout.write('['+this.toString()+']'+EOL); | ||
out.write('['+this.toString()+']'+EOL); | ||
}); | ||
Boolean.prototype.__defineGetter__('log', function() { | ||
process.stdout.write(this.toString()); | ||
out.write(this.toString()); | ||
}); | ||
Boolean.prototype.__defineGetter__('logn', function() { | ||
process.stdout.write(this.toString()+EOL); | ||
out.write(this.toString()+EOL); | ||
}); | ||
Object.prototype.__defineGetter__('print', function() { | ||
process.stdout.write(inspect(this)); | ||
out.write(inspect(this)); | ||
}); | ||
Object.prototype.__defineGetter__('logn', function() { | ||
process.stdout.write(inspect(this)+EOL); | ||
out.write(inspect(this)+EOL); | ||
}); |
@@ -6,5 +6,9 @@ qlt | ||
Create output on the fly and print it with just a few keystrokes. | ||
```javascript | ||
var how_is_it = 'awesome'; | ||
('Wow, this is ' + how_is_it).logn; | ||
//This produces the same | ||
'Wow, this is'.log; how_is_it.logn; | ||
``` | ||
@@ -14,7 +18,7 @@ | ||
It's a cleaner and faster way to display output from your app. | ||
It's a more convinient, cleaner and even faster (25% compared to console.log) way to display output from your app. | ||
Great! How can i use it? | ||
--- | ||
###Great! How can i use it? | ||
All datatypes (not only strings!) are provided with two new properties: | ||
@@ -27,5 +31,5 @@ | ||
Install | ||
--- | ||
###Install | ||
``` | ||
@@ -72,1 +76,4 @@ npm install qlt | ||
``` | ||
##Comming soon | ||
* stderr support |
5143
2.55%55
1.85%75
8.7%