source: imaps-frontend/node_modules/webpack-sources/lib/helpers/splitIntoLines.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 447 bytes
RevLine 
[79a0317]1const splitIntoLines = str => {
2 const results = [];
3 const len = str.length;
4 let i = 0;
5 for (; i < len; ) {
6 const cc = str.charCodeAt(i);
7 // 10 is "\n".charCodeAt(0)
8 if (cc === 10) {
9 results.push("\n");
10 i++;
11 } else {
12 let j = i + 1;
13 // 10 is "\n".charCodeAt(0)
14 while (j < len && str.charCodeAt(j) !== 10) j++;
15 results.push(str.slice(i, j + 1));
16 i = j + 1;
17 }
18 }
19 return results;
20};
21module.exports = splitIntoLines;
Note: See TracBrowser for help on using the repository browser.