vui-design
Version:
A high quality UI Toolkit based on Vue.js
19 lines (15 loc) • 419 B
JavaScript
export default function padEnd(value, length, chars) {
const string = String(value);
length = length >> 0;
chars = String(typeof chars !== "undefined" ? chars : " ");
if (string.length > length) {
return string;
}
else {
length = length - string.length;
if (length > chars.length) {
chars += chars.repeat(length / chars.length);
}
return string + chars.slice(0, length);
}
};