neat-frame
Generate simple framed text
Last updated a year ago by shinnn .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install neat-frame 
SYNC missed versions from official npm registry.

neat-frame

npm version Build Status Coverage Status

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
    • Single-line border
    • 1 padding between text and borders
    • 2 horizontal spaces on both side of the box
    • Left-aligned text
  • Automatic box width adjustment for the current terminal width
  • 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           │
  │              │
  └──────────────┘
*/

License

ISC License © 2017 Shinnosuke Watanabe

Current Tags

  • 1.0.2                                ...           latest (a year ago)

7 Versions

  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
  • 0.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 16
Last Day 0
Last Week 8
Last Month 1
Dependencies (4)
Dev Dependencies (6)

Copyright 2014 - 2017 © taobao.org |