1.1.29 • Published 12 months ago

index-of-newline v1.1.29

Weekly downloads
-
License
MIT
Repository
github
Last release
12 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

12 months ago

1.1.28

12 months 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

12 months ago

1.1.22

12 months ago

1.1.21

12 months ago

1.1.20

12 months ago

1.1.27

12 months ago

1.1.26

12 months ago

1.1.25

12 months ago

1.1.24

12 months 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