A wide-character aware text alignment function for use in terminals / on the console.
npm install @slimio/text-alignA wide-character aware text alignment function for use in terminals / on the console. This package is a modern implementation of wide-align with String.prototype.padLeft and String.prototype.padRight.
This package is available in the Node Package Repository and can be easily installed with npm or yarn.
``bash`
$ npm i @slimio/text-alignor
$ yarn add @slimio/text-align
`js
const align = require("@slimio/text-align");
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)); // ' 古古古'
``
|Name|Refactoring|Security Risk|Usage|
|---|---|---|---|
|@slimio/wcwidth|Minor|Low|Determine columns needed for a fixed-size wide-character string|