1.1.29 • Published 5 months ago

index-of-newline v1.1.29

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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

API Docs

1.1.29

5 months ago

1.1.28

5 months ago

1.1.12

6 months ago

1.1.11

6 months ago

1.1.10

6 months ago

1.1.16

6 months ago

1.1.15

6 months ago

1.1.14

6 months ago

1.1.13

6 months ago

1.1.17

6 months ago

1.1.23

6 months ago

1.1.22

6 months ago

1.1.21

6 months ago

1.1.20

6 months ago

1.1.27

5 months ago

1.1.26

6 months ago

1.1.25

6 months ago

1.1.24

6 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