-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.d.ts
30 lines (23 loc) · 811 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
Detect the dominant newline character of a string.
@returns The detected newline or `undefined` when no newline character is found or `\n` when no dominant newline is present.
@example
```
import {detectNewline} from 'detect-newline';
detectNewline('foo\nbar\nbaz\r\n');
//=> '\n'
```
*/
export function detectNewline(string: string): '\r\n' | '\n' | undefined;
/**
Detect the dominant newline character of a string.
@returns The detected newline or `\n` when no newline character is found, no dominant newline is present, or the input is not a string.
@example
```
import {detectNewlineGraceful} from 'detect-newline';
detectNewlineGraceful('foo');
//=> '\n'
```
*/
export function detectNewlineGraceful(string: string): '\r\n' | '\n';
export function detectNewlineGraceful(string?: unknown): '\n';