This repository was archived by the owner on Jan 22, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.d.ts
More file actions
70 lines (55 loc) · 1.45 KB
/
index.d.ts
File metadata and controls
70 lines (55 loc) · 1.45 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
export type KEY_VALUE = "KEY_VALUE";
export type COMMENT = "COMMENT";
export type INVALID_LINE = "INVALID_LINE";
export const KEY_VALUE: KEY_VALUE;
export const COMMENT: COMMENT;
export const INVALID_LINE: INVALID_LINE;
// single quote, double quote, or empty string
export type Quote = '"' | "'" | "";
export interface DotenvKeyValueNode {
type: KEY_VALUE;
key: string;
fullKey: string;
value: string;
escapedValue: string;
fullValue: string;
quote: Quote;
originalQuote: Quote;
}
export interface DotenvCommentNode {
type: COMMENT;
prefix: string;
comment: string;
}
export interface DotenvInvalidLineNode {
type: INVALID_LINE;
text: string;
}
export type DotenvNode =
| DotenvCommentNode
| DotenvKeyValueNode
| DotenvInvalidLineNode;
export type DotenvNodeList = DotenvNode[];
export function textToNodes(text: string): DotenvNodeList;
export function nodesToText(nodeList: DotenvNodeList): string;
export function appendKeyValue(
nodeList: DotenvNodeList,
key: string,
value: string,
): DotenvNodeList;
export function changeKey(
nodeList: DotenvNodeList,
index: number,
newKey: string,
): DotenvNodeList;
export function changeValue(
nodeList: DotenvNodeList,
index: number,
newValue: string,
): DotenvNodeList;
export function removeKeyValue(
nodeList: DotenvNodeList,
index: number,
): DotenvNodeList;
export function parseNodes(nodeList: DotenvNodeList): Record<string, any>;
export function parseText(text: string): Record<string, any>;