1.1.29 • Published 1 year 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); // 24Example 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
1 year ago
1.1.28
1 year ago
1.1.12
1 year ago
1.1.11
1 year ago
1.1.10
1 year ago
1.1.16
1 year ago
1.1.15
1 year ago
1.1.14
1 year ago
1.1.13
1 year ago
1.1.17
1 year ago
1.1.23
1 year ago
1.1.22
1 year ago
1.1.21
1 year ago
1.1.20
1 year ago
1.1.27
1 year ago
1.1.26
1 year ago
1.1.25
1 year ago
1.1.24
1 year ago
1.1.8
4 years ago
1.1.7
4 years ago
1.1.6
4 years ago
1.1.5
4 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