Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inDemoInstall

wide-align

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Issues
File Explorer

Advanced tools

wide-align

A wide-character aware text alignment function for use on the console or with fixed width fonts.

    1.1.5latest
    Github

Version published
Maintainers
1
Weekly downloads
14,400,206
decreased by-17.61%

Weekly downloads

Readme

Source

wide-align

A wide-character aware text alignment function for use in terminals / on the console.

Usage

var align = require('wide-align') // Note that if you view this on a unicode console, all of the slashes are // aligned. This is because on a console, all narrow characters are // an en wide and all wide characters are an em. In browsers, this isn't // held to and wide characters like "古" can be less than two narrow // characters even with a fixed width font. console.log(align.center('abc', 10)) // ' abc ' console.log(align.center('古古古', 10)) // ' 古古古 ' console.log(align.left('abc', 10)) // 'abc ' console.log(align.left('古古古', 10)) // '古古古 ' console.log(align.right('abc', 10)) // ' abc' console.log(align.right('古古古', 10)) // ' 古古古'

Functions

align.center(str, length)str

Returns str with spaces added to both sides such that that it is length chars long and centered in the spaces.

align.left(str, length)str

Returns str with spaces to the right such that it is length chars long.

align.right(str, length)str

Returns str with spaces to the left such that it is length chars long.

Origins

These functions were originally taken from cliui. Changes include switching to the MUCH faster pad generation function from lodash, making center alignment pad both sides and adding left alignment.

Keywords

FAQs

What is wide-align?

A wide-character aware text alignment function for use on the console or with fixed width fonts.

Is wide-align popular?

The npm package wide-align receives a total of 11,485,690 weekly downloads. As such, wide-align popularity was classified as popular.

Is wide-align well maintained?

We found that wide-align demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 15 Oct 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket[email protected]

Product

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc