2021-08-19 14:19:14 +00:00
|
|
|
export default (str) => {
|
2019-09-13 20:02:41 +00:00
|
|
|
var regexString = ".{1,15}([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)";
|
|
|
|
var re = new RegExp(regexString, "g");
|
|
|
|
var lines = str.match(re) || [];
|
|
|
|
var result = lines.map((line) => {
|
|
|
|
if (line.slice(-1) === "\n") {
|
|
|
|
line = line.slice(0, line.length - 1);
|
|
|
|
}
|
|
|
|
return line;
|
|
|
|
}).join("\n");
|
|
|
|
return result;
|
|
|
|
};
|