@o3co/ts.hocon 0.1.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/dist/index.cjs +1259 -516
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1259 -516
- package/dist/{parse-C1NDMzD5.d.cts → parse-nNbyqnOh.d.cts} +11 -6
- package/dist/{parse-C1NDMzD5.d.ts → parse-nNbyqnOh.d.ts} +11 -6
- package/dist/zod.cjs +1249 -514
- package/dist/zod.d.cts +1 -1
- package/dist/zod.d.ts +1 -1
- package/dist/zod.js +1249 -514
- package/package.json +10 -2
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
type DurationUnit = 'ns' | 'us' | 'ms' | 's' | 'm' | 'h' | 'd';
|
|
2
|
+
type ByteUnit = 'B' | 'KB' | 'KiB' | 'MB' | 'MiB' | 'GB' | 'GiB' | 'TB' | 'TiB';
|
|
3
|
+
|
|
4
|
+
type ScalarValueType = 'string' | 'number' | 'boolean' | 'null';
|
|
1
5
|
type HoconValue = {
|
|
2
6
|
kind: 'object';
|
|
3
7
|
fields: Map<string, HoconValue>;
|
|
@@ -6,7 +10,8 @@ type HoconValue = {
|
|
|
6
10
|
items: HoconValue[];
|
|
7
11
|
} | {
|
|
8
12
|
kind: 'scalar';
|
|
9
|
-
|
|
13
|
+
raw: string;
|
|
14
|
+
valueType: ScalarValueType;
|
|
10
15
|
};
|
|
11
16
|
|
|
12
17
|
declare class Config {
|
|
@@ -18,6 +23,8 @@ declare class Config {
|
|
|
18
23
|
getString(path: string): string;
|
|
19
24
|
getNumber(path: string): number;
|
|
20
25
|
getBoolean(path: string): boolean;
|
|
26
|
+
getDuration(path: string, unit?: DurationUnit): number;
|
|
27
|
+
getBytes(path: string, unit?: ByteUnit): number;
|
|
21
28
|
getConfig(path: string): Config;
|
|
22
29
|
getList(path: string): unknown[];
|
|
23
30
|
has(path: string): boolean;
|
|
@@ -36,13 +43,11 @@ type ParseOptions = {
|
|
|
36
43
|
};
|
|
37
44
|
declare function parse(input: string, opts?: ParseOptions): Config;
|
|
38
45
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* Note: `include` directives in string input are resolved synchronously
|
|
42
|
-
* via `readFileSync`; `readFile` is not used by this function.
|
|
46
|
+
* Truly async version of `parse()`. Include directives are resolved
|
|
47
|
+
* asynchronously via `readFile` when provided.
|
|
43
48
|
*/
|
|
44
49
|
declare function parseAsync(input: string, opts?: ParseOptions): Promise<Config>;
|
|
45
50
|
declare function parseFile(filePath: string, opts?: ParseOptions): Config;
|
|
46
51
|
declare function parseFileAsync(filePath: string, opts?: ParseOptions): Promise<Config>;
|
|
47
52
|
|
|
48
|
-
export { Config as C, type HoconValue as H, type ParseOptions as P, parseAsync as a, parseFile as b, parseFileAsync as c, parse as p };
|
|
53
|
+
export { type ByteUnit as B, Config as C, type DurationUnit as D, type HoconValue as H, type ParseOptions as P, type ScalarValueType as S, parseAsync as a, parseFile as b, parseFileAsync as c, parse as p };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
type DurationUnit = 'ns' | 'us' | 'ms' | 's' | 'm' | 'h' | 'd';
|
|
2
|
+
type ByteUnit = 'B' | 'KB' | 'KiB' | 'MB' | 'MiB' | 'GB' | 'GiB' | 'TB' | 'TiB';
|
|
3
|
+
|
|
4
|
+
type ScalarValueType = 'string' | 'number' | 'boolean' | 'null';
|
|
1
5
|
type HoconValue = {
|
|
2
6
|
kind: 'object';
|
|
3
7
|
fields: Map<string, HoconValue>;
|
|
@@ -6,7 +10,8 @@ type HoconValue = {
|
|
|
6
10
|
items: HoconValue[];
|
|
7
11
|
} | {
|
|
8
12
|
kind: 'scalar';
|
|
9
|
-
|
|
13
|
+
raw: string;
|
|
14
|
+
valueType: ScalarValueType;
|
|
10
15
|
};
|
|
11
16
|
|
|
12
17
|
declare class Config {
|
|
@@ -18,6 +23,8 @@ declare class Config {
|
|
|
18
23
|
getString(path: string): string;
|
|
19
24
|
getNumber(path: string): number;
|
|
20
25
|
getBoolean(path: string): boolean;
|
|
26
|
+
getDuration(path: string, unit?: DurationUnit): number;
|
|
27
|
+
getBytes(path: string, unit?: ByteUnit): number;
|
|
21
28
|
getConfig(path: string): Config;
|
|
22
29
|
getList(path: string): unknown[];
|
|
23
30
|
has(path: string): boolean;
|
|
@@ -36,13 +43,11 @@ type ParseOptions = {
|
|
|
36
43
|
};
|
|
37
44
|
declare function parse(input: string, opts?: ParseOptions): Config;
|
|
38
45
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* Note: `include` directives in string input are resolved synchronously
|
|
42
|
-
* via `readFileSync`; `readFile` is not used by this function.
|
|
46
|
+
* Truly async version of `parse()`. Include directives are resolved
|
|
47
|
+
* asynchronously via `readFile` when provided.
|
|
43
48
|
*/
|
|
44
49
|
declare function parseAsync(input: string, opts?: ParseOptions): Promise<Config>;
|
|
45
50
|
declare function parseFile(filePath: string, opts?: ParseOptions): Config;
|
|
46
51
|
declare function parseFileAsync(filePath: string, opts?: ParseOptions): Promise<Config>;
|
|
47
52
|
|
|
48
|
-
export { Config as C, type HoconValue as H, type ParseOptions as P, parseAsync as a, parseFile as b, parseFileAsync as c, parse as p };
|
|
53
|
+
export { type ByteUnit as B, Config as C, type DurationUnit as D, type HoconValue as H, type ParseOptions as P, type ScalarValueType as S, parseAsync as a, parseFile as b, parseFileAsync as c, parse as p };
|