1.1.29 • Published 9 months ago
index-of-newline v1.1.29
index-of-newline
Find next line ending in CR, LF or CRLF
Example 1
import indexOfNewline from "index-of-newline";
const string = "some\r\nstring\ncombination\r";
let index = indexOfNewline(string) as number;
console.log(index); // 4
index = indexOfNewline(string, index + 2) as number;
console.log(index); // 12
index = indexOfNewline(string, index + 1) as number;
console.log(index); // 24
Example 2
import indexOfNewline from "index-of-newline";
const string = "some\r\nstring\ncombination\r";
const results = [];
let [index, length] = indexOfNewline(string, 0, true) as number[];
while (index >= 0) {
results.push(index);
[index, length] = indexOfNewline(string, index + length, true) as number[];
}
console.log(results); // [4, 12, 24]
Documentation
1.1.29
9 months ago
1.1.28
9 months ago
1.1.12
10 months ago
1.1.11
10 months ago
1.1.10
10 months ago
1.1.16
10 months ago
1.1.15
10 months ago
1.1.14
10 months ago
1.1.13
10 months ago
1.1.17
10 months ago
1.1.23
9 months ago
1.1.22
9 months ago
1.1.21
9 months ago
1.1.20
9 months ago
1.1.27
9 months ago
1.1.26
9 months ago
1.1.25
9 months ago
1.1.24
9 months ago
1.1.8
3 years ago
1.1.7
3 years ago
1.1.6
3 years ago
1.1.5
3 years ago
1.1.4
4 years ago
1.1.3
4 years ago
1.1.1
4 years ago
1.1.2
4 years ago
1.1.0
4 years ago
1.0.0
4 years ago