UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

6 lines (4 loc) 166 B
function pad(str, length, chars = ' ') { return str.padStart(Math.floor((length - str.length) / 2) + str.length, chars).padEnd(length, chars); } export { pad };