1.0.2 • Published 8 years ago
output-formatter v1.0.2
output-formatter
format helper for output
const fmt = require('output-formatter');
fmt.left(str, len)
fmt.left('hello', 10).should.equal('hello ');
fmt.left('hello', 5).should.equal('hello');
fmt.left('hello', 2).should.equal('hello');
fmt.left(234, 5).should.equal('234 ');
fmt.left(null, 5).should.equal('null ');
fmt.center(str, len)
fmt.center('hi', 10).should.be.equal(' hi ');
fmt.center('hi', 9).should.be.equal(' hi ');
fmt.center('hi', 2).should.be.equal('hi');
fmt.center('hi', 1).should.be.equal('hi');
fmt.center(0, 5).should.equal(' 0 ');
fmt.center(undefined, 5).should.equal('undefined');
fmt.right(str, len)
fmt.right('world', 10).should.be.equal(' world');
fmt.right('world', 5).should.be.equal('world');
fmt.right('world', 1).should.be.equal('world');
fmt.right(true, 1).should.equal('true');
fmt.line(ch, num)
fmt.line('-', 5).should.be.equal('-----');
fmt.line('+', 0).should.be.equal('');
fmt.red(msg)
console.log(fmt.red('hello world'));
fmt.yellow(msg)
console.log(fmt.yellow('warning'));