JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20
  • Score
    100M100P100Q50418F
  • License ISC

Generate simple framed text

Package Exports

  • neat-frame

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (neat-frame) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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