Returns stringer which pads given input with ch (default: space) on both sides and returns fixed width string of given lineWidth. Returns string of only pad characters for any null or undefined values. If the string version of an input is > lineWidth, no centering is performed, but the string will be truncated to lineWidth.
Note: The padding string can contain multiple characters.
Returns stringer which pads given input with
ch
(default: space) on both sides and returns fixed width string of givenlineWidth
. Returns string of only pad characters for anynull
orundefined
values. If the string version of an input is >lineWidth
, no centering is performed, but the string will be truncated tolineWidth
.Note: The padding string can contain multiple characters.
center(20, "<>")(wrap(" ")("thi.ng")) // "<><><> thi.ng <><><>"
target length
pad character(s)