Returns a string of spaces.
-
5x Faster than
' '.repeat(n)
. - Uses cache &
substr
.
This is part of package extra-string.
var space = require('@extra-string/space');
// space(<length>)
space(4); // ' '
space(6); // ' '
space(0); // ''
space(-1); // ''