diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-05-13 13:20:59 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-05-13 13:20:59 -0300 |
commit | 34b7ff22766bae0e4b1b3121bd63d037c27285c7 (patch) | |
tree | f2f66a17c67bdf9be0b1576b28ffd0cf107b483c /util/wrap.js | |
parent | 684e369c7b01b4c69995fc604ef33919077ffdf5 (diff) | |
parent | a37d6be77261b2aae25c4235dcb38dd7b1bb60b1 (diff) |
Merge remote-tracking branch 'notabug/master'
Diffstat (limited to 'util/wrap.js')
-rw-r--r-- | util/wrap.js | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/util/wrap.js b/util/wrap.js deleted file mode 100644 index 2c720c8..0000000 --- a/util/wrap.js +++ /dev/null @@ -1,22 +0,0 @@ -export default function wrap(str, width) { - // Wraps a string into separate lines. Returns an array of strings, for - // each line of the text. - - const lines = [] - const words = str.split(' ') - - let curLine = words[0] - - for (const word of words.slice(1)) { - if (curLine.length + word.length > width) { - lines.push(curLine) - curLine = word - } else { - curLine += ' ' + word - } - } - - lines.push(curLine) - - return lines -} |