Files
cypress/packages/server/lib/util/newlines.js
T
2021-11-01 13:37:33 -04:00

19 lines
265 B
JavaScript

const addNewlineAtEveryNChar = (str, n) => {
if (!str) {
return str
}
let result = []
let idx = 0
while (idx < str.length) {
result.push(str.slice(idx, idx += n))
}
return result.join('\n')
}
module.exports = {
addNewlineAtEveryNChar,
}