mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-03 21:40:28 -05:00
19 lines
265 B
JavaScript
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,
|
|
}
|