smart-line

1.0.2 • Public • Published

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  ');

/smart-line/

    Package Sidebar

    Install

    npm i smart-line

    Weekly Downloads

    1

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    8.13 kB

    Total Files

    4

    Last publish

    Collaborators

    • felipep