string-align
Align string with whitespace. Whitespace character defaults to ascii space.
Examples
> ' foo ' > 'foo ' > ' foo' > '-=-=-=-' > '__foo__' > '0007'
API
stringAlign(string, width, [alignment], [placeholder])
stringAlign(string, options)
If string
or placeholder
is not a string, it is converted to.
Option | Type | Required? | Default |
---|---|---|---|
width | number | Yes | |
alignment | "center", "left", "right", "fill" | No | "center" |
placeholder | string | No | " " |
Install
npm install string-align
License
MIT