single-line-log
Advanced tools
Comparing version 1.0.1 to 1.1.0
22
index.js
var MOVE_LEFT = new Buffer('1b5b3130303044', 'hex').toString(); | ||
var MOVE_UP = new Buffer('1b5b3141', 'hex').toString(); | ||
var CLEAR_LINE = new Buffer('1b5b304b', 'hex').toString(); | ||
var stringWidth = require('string-width'); | ||
@@ -35,3 +36,7 @@ module.exports = function(stream) { | ||
// How many lines to remove on next clear screen | ||
prevLineCount = nextStr.split('\n').length; | ||
prevLines = nextStr.split('\n'); | ||
prevLineCount = prevLines.length; | ||
for (var i=0; i < prevLines.length; i++) { | ||
if (stream.columns < stringWidth(prevLines[i])) prevLineCount += 1; | ||
} | ||
}; | ||
@@ -48,16 +53,1 @@ | ||
module.exports.stderr = module.exports(process.stderr); | ||
if (require.main !== module) return; | ||
var log = module.exports.stdout; | ||
var i=0; | ||
setInterval(function() { | ||
i++; | ||
var s = 'line 1 - '+Math.random(); | ||
if (i < 10) s += ' - '+Math.random(); | ||
s += '\nline 2 - '+Math.random(); | ||
if (i<20) s += '\nline 3 - '+Math.random()+'\nline 4 - '+Math.random(); | ||
log(s); | ||
}, 200); |
@@ -17,6 +17,12 @@ { | ||
], | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"repository": "git://github.com/freeall/single-line-log.git", | ||
"license": "MIT", | ||
"author": "Tobias Baunbæk <freeall@gmail.com>" | ||
"author": "Tobias Baunbæk <freeall@gmail.com>", | ||
"dependencies": { | ||
"string-width": "^1.0.1" | ||
}, | ||
"scripts": { | ||
"test": "node test.js" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3342
5
56
1
+ Addedstring-width@^1.0.1
+ Addedansi-regex@2.1.1(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addedis-fullwidth-code-point@1.0.0(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedstring-width@1.0.2(transitive)
+ Addedstrip-ansi@3.0.1(transitive)