neat-frame
Generate simple framed text
const neatFrame = require('neat-frame');
console.log(neatFrame(`neat-frame
Generate simple framed text from a string`));
┌──────────────────────────────────────────────────────────────────────────┐
│ │
│ neat-frame │
│ Generate simple framed text from a string │
│ │
└──────────────────────────────────────────────────────────────────────────┘
- No config, 1 simple beautiful output
- Automatic box width adjustment for the current terminal width
process.stdout.columns
is unavailable- Automatic line breaking for long text
Installation
Use npm.npm install neat-frame
API
const neatFrame = require('neat-frame');
neatFrame(input)
input:string
Return:
string
// When the terminal width is 30
neatFrame('abcdefghijklmnopqrstuvwxyz');
/* =>
┌────────────────────────┐
│ │
│ abcdefghijklmnopqrstuv │
│ wxyz │
│ │
└────────────────────────┘
*/
// When the terminal width is 20
neatFrame('abcdefghijklmnopqrstuvwxyz');
/* =>
┌──────────────┐
│ │
│ abcdefghijkl │
│ mnopqrstuvwx │
│ yz │
│ │
└──────────────┘
*/