Files
30-seconds-of-code/test/pad/pad.js
2018-02-24 17:47:36 +01:00

4 lines
146 B
JavaScript

const pad = (string, length = 8, char = ' ') =>
string.padStart((string.length + length) / 2, char).padEnd(length, char);
module.exports = pad;