smart-line
A smart fixed line with some formatting abilities
usage
const smartLine = require('smart-line').line;
center
var line = new smartLine(10);
line.center('abc');
assert.equal(line,' abc ');
left
var line = new smartLine(10);
line.left('xyz');
assert.equal(line,'xyz ');
line.left('abc',7);
assert.equal(line,'xyz abc ');
right
Please note that for legacy reasons the position is the start of the insertion
var line = new smartLine(10);
line.right('testing',5,4);
assert.equal(line,' ting ');
line.reset();
line.right('testing');
assert.equal(line,' testing');
insert
var line = new smartLine(10);
line.insert('abc',6);
assert.equal(line,' abc ');