typia 3.5.2 → 3.5.4
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 +16 -2
- package/lib/IRandomGenerator.d.ts +8 -8
- package/lib/executable/TypiaSetupWizard.d.ts +8 -0
- package/lib/executable/TypiaSetupWizard.js +218 -0
- package/lib/executable/TypiaSetupWizard.js.map +1 -0
- package/lib/executable/setup/ArgumentParser.d.ts +7 -0
- package/lib/executable/setup/ArgumentParser.js +155 -0
- package/lib/executable/setup/ArgumentParser.js.map +1 -0
- package/lib/executable/{internal → setup}/CommandExecutor.d.ts +0 -0
- package/lib/executable/{internal → setup}/CommandExecutor.js +0 -0
- package/lib/executable/setup/CommandExecutor.js.map +1 -0
- package/lib/executable/{internal → setup}/PackageManager.d.ts +0 -0
- package/lib/executable/{internal → setup}/PackageManager.js +0 -0
- package/lib/executable/setup/PackageManager.js.map +1 -0
- package/lib/executable/setup/PluginConfigurator.d.ts +5 -0
- package/lib/executable/{internal → setup}/PluginConfigurator.js +1 -0
- package/lib/executable/setup/PluginConfigurator.js.map +1 -0
- package/lib/executable/typia.js +2 -52
- package/lib/executable/typia.js.map +1 -1
- package/lib/module.d.ts +14 -8
- package/lib/module.js +2 -1
- package/lib/module.js.map +1 -1
- package/lib/programmers/RandomProgrammer.js +57 -51
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/helpers/RandomJoiner.d.ts +2 -2
- package/lib/programmers/helpers/RandomJoiner.js +59 -49
- package/lib/programmers/helpers/RandomJoiner.js.map +1 -1
- package/lib/programmers/helpers/RandomRanger.d.ts +1 -1
- package/lib/programmers/helpers/RandomRanger.js +22 -20
- package/lib/programmers/helpers/RandomRanger.js.map +1 -1
- package/package.json +1 -1
- package/src/IRandomGenerator.ts +8 -8
- package/src/executable/{internal/ArgumentParser.ts → TypiaSetupWizard.ts} +58 -59
- package/src/executable/setup/ArgumentParser.ts +89 -0
- package/src/executable/{internal → setup}/CommandExecutor.ts +0 -0
- package/src/executable/{internal → setup}/PackageManager.ts +0 -0
- package/src/executable/{internal → setup}/PluginConfigurator.ts +4 -3
- package/src/executable/typia.ts +2 -42
- package/src/module.ts +23 -11
- package/src/programmers/RandomProgrammer.ts +75 -69
- package/src/programmers/helpers/RandomJoiner.ts +14 -12
- package/src/programmers/helpers/RandomRanger.ts +2 -1
- package/lib/executable/internal/ArgumentParser.d.ts +0 -9
- package/lib/executable/internal/ArgumentParser.js +0 -265
- package/lib/executable/internal/ArgumentParser.js.map +0 -1
- package/lib/executable/internal/CommandExecutor.js.map +0 -1
- package/lib/executable/internal/PackageManager.js.map +0 -1
- package/lib/executable/internal/PluginConfigurator.d.ts +0 -5
- package/lib/executable/internal/PluginConfigurator.js.map +0 -1
package/package.json
CHANGED
package/src/IRandomGenerator.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export interface IRandomGenerator {
|
|
2
2
|
boolean(): boolean;
|
|
3
|
-
|
|
3
|
+
integer(minimum?: number, maximum?: number): number;
|
|
4
4
|
number(minimum?: number, maximum?: number): number;
|
|
5
5
|
bigint(minimum?: bigint, maximum?: bigint): bigint;
|
|
6
6
|
string(length?: number): string;
|
|
7
7
|
array<T>(closure: (index: number) => T, count?: number): T[];
|
|
8
8
|
|
|
9
|
-
uuid
|
|
10
|
-
email
|
|
11
|
-
url
|
|
12
|
-
ipv4
|
|
13
|
-
ipv6
|
|
14
|
-
pattern
|
|
15
|
-
date
|
|
9
|
+
uuid(): string;
|
|
10
|
+
email(): string;
|
|
11
|
+
url(): string;
|
|
12
|
+
ipv4(): string;
|
|
13
|
+
ipv6(): string;
|
|
14
|
+
pattern(regex: RegExp): string;
|
|
15
|
+
date(): string;
|
|
16
16
|
}
|
|
@@ -1,80 +1,71 @@
|
|
|
1
|
-
import type CommanderModule from "commander";
|
|
2
1
|
import fs from "fs";
|
|
3
|
-
import type * as InquirerModule from "inquirer";
|
|
4
2
|
import path from "path";
|
|
5
3
|
|
|
6
|
-
import {
|
|
4
|
+
import { ArgumentParser } from "./setup/ArgumentParser";
|
|
5
|
+
import { CommandExecutor } from "./setup/CommandExecutor";
|
|
6
|
+
import { PackageManager } from "./setup/PackageManager";
|
|
7
|
+
import { PluginConfigurator } from "./setup/PluginConfigurator";
|
|
7
8
|
|
|
8
|
-
export namespace
|
|
9
|
+
export namespace TypiaSetupWizard {
|
|
9
10
|
export interface IArguments {
|
|
10
11
|
compiler: "ts-patch" | "ttypescript";
|
|
11
12
|
manager: "npm" | "pnpm" | "yarn";
|
|
12
13
|
project: string | null;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export async function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
dev: true,
|
|
20
|
-
modulo: "commander",
|
|
21
|
-
silent: true,
|
|
22
|
-
}),
|
|
23
|
-
inquirer: pack.install({
|
|
24
|
-
dev: true,
|
|
25
|
-
modulo: "inquirer",
|
|
26
|
-
version: "8.2.5",
|
|
27
|
-
silent: true,
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
16
|
+
export async function setup(): Promise<void> {
|
|
17
|
+
console.log("----------------------------------------");
|
|
18
|
+
console.log(" Typia Setup Wizard");
|
|
19
|
+
console.log("----------------------------------------");
|
|
30
20
|
|
|
31
|
-
//
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
// PREPARE ASSETS
|
|
22
|
+
const pack: PackageManager = await PackageManager.mount();
|
|
23
|
+
const args: IArguments = await ArgumentParser.parse(pack)(true)(
|
|
24
|
+
inquiry,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// INSTALL TYPESCRIPT
|
|
28
|
+
pack.install({ dev: true, modulo: "typescript" });
|
|
29
|
+
args.project ??= (() => {
|
|
30
|
+
CommandExecutor.run("npx tsc --init", false);
|
|
31
|
+
return (args.project = "tsconfig.json");
|
|
38
32
|
})();
|
|
33
|
+
pack.install({ dev: true, modulo: "ts-node" });
|
|
39
34
|
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
if (
|
|
35
|
+
// INSTALL COMPILER
|
|
36
|
+
pack.install({ dev: true, modulo: args.compiler });
|
|
37
|
+
if (args.compiler === "ts-patch") {
|
|
38
|
+
await pack.save((data) => {
|
|
39
|
+
data.scripts ??= {};
|
|
40
|
+
if (
|
|
41
|
+
typeof data.scripts.prepare === "string" &&
|
|
42
|
+
data.scripts.prepare.indexOf("ts-patch install") === -1
|
|
43
|
+
)
|
|
44
|
+
data.scripts.prepare =
|
|
45
|
+
"ts-patch install && " + data.scripts.prepare;
|
|
46
|
+
else data.scripts.prepare = "ts-patch install";
|
|
47
|
+
});
|
|
48
|
+
CommandExecutor.run("npm run prepare", false);
|
|
49
|
+
}
|
|
43
50
|
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
// INSTALL AND CONFIGURE TYPIA
|
|
52
|
+
pack.install({ dev: false, modulo: "typia" });
|
|
53
|
+
await PluginConfigurator.configure(pack, args);
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
const inquiry: ArgumentParser.Inquiry<IArguments> = async (
|
|
57
|
+
pack,
|
|
58
|
+
command,
|
|
59
|
+
prompt,
|
|
60
|
+
action,
|
|
61
|
+
) => {
|
|
50
62
|
// PREPARE ASSETS
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
54
|
-
const { program }: typeof CommanderModule = await import(
|
|
55
|
-
path.join(pack.directory, "node_modules", "commander")
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
program.option("--compiler [compiler]", "compiler type");
|
|
59
|
-
program.option("--manager [manager", "package manager");
|
|
60
|
-
program.option("--project [project]", "tsconfig.json file location");
|
|
63
|
+
command.option("--compiler [compiler]", "compiler type");
|
|
64
|
+
command.option("--manager [manager", "package manager");
|
|
65
|
+
command.option("--project [project]", "tsconfig.json file location");
|
|
61
66
|
|
|
62
67
|
// INTERNAL PROCEDURES
|
|
63
68
|
const questioned = { value: false };
|
|
64
|
-
const action = (
|
|
65
|
-
closure: (options: Partial<IArguments>) => Promise<IArguments>,
|
|
66
|
-
) => {
|
|
67
|
-
return new Promise<IArguments>((resolve, reject) => {
|
|
68
|
-
program.action(async (options) => {
|
|
69
|
-
try {
|
|
70
|
-
resolve(await closure(options));
|
|
71
|
-
} catch (exp) {
|
|
72
|
-
reject(exp);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
program.parseAsync().catch(reject);
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
69
|
const select =
|
|
79
70
|
(name: string) =>
|
|
80
71
|
(message: string) =>
|
|
@@ -83,7 +74,7 @@ export namespace ArgumentParser {
|
|
|
83
74
|
): Promise<Choice> => {
|
|
84
75
|
questioned.value = true;
|
|
85
76
|
return (
|
|
86
|
-
await
|
|
77
|
+
await prompt()({
|
|
87
78
|
type: "list",
|
|
88
79
|
name: name,
|
|
89
80
|
message: message,
|
|
@@ -112,7 +103,7 @@ export namespace ArgumentParser {
|
|
|
112
103
|
if (options.compiler === undefined) {
|
|
113
104
|
console.log(COMPILER_DESCRIPTION);
|
|
114
105
|
options.compiler = await select("compiler")(`Compiler`)(
|
|
115
|
-
pack
|
|
106
|
+
is_nest_cli(pack)
|
|
116
107
|
? ["ts-patch" as const, "ttypescript" as const]
|
|
117
108
|
: ["ttypescript" as const, "ts-patch" as const],
|
|
118
109
|
);
|
|
@@ -128,6 +119,14 @@ export namespace ArgumentParser {
|
|
|
128
119
|
if (questioned.value) console.log("");
|
|
129
120
|
return options as IArguments;
|
|
130
121
|
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
function is_nest_cli(pack: PackageManager): boolean {
|
|
125
|
+
return (
|
|
126
|
+
(typeof pack.data.scripts?.build === "string" &&
|
|
127
|
+
pack.data.scripts.build.indexOf("nest build") !== -1) ||
|
|
128
|
+
fs.existsSync(path.join(pack.directory, "nest-cli.json"))
|
|
129
|
+
);
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type CommanderModule from "commander";
|
|
2
|
+
import type * as InquirerModule from "inquirer";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
import { PackageManager } from "./PackageManager";
|
|
6
|
+
|
|
7
|
+
export namespace ArgumentParser {
|
|
8
|
+
export type Inquiry<T> = (
|
|
9
|
+
pack: PackageManager,
|
|
10
|
+
command: CommanderModule.Command,
|
|
11
|
+
prompt: (
|
|
12
|
+
opt?: InquirerModule.StreamOptions,
|
|
13
|
+
) => InquirerModule.PromptModule,
|
|
14
|
+
action: (closure: (options: Partial<T>) => Promise<T>) => Promise<T>,
|
|
15
|
+
) => Promise<T>;
|
|
16
|
+
|
|
17
|
+
export const parse =
|
|
18
|
+
(pack: PackageManager) =>
|
|
19
|
+
(erase: boolean) =>
|
|
20
|
+
async <T>(
|
|
21
|
+
inquiry: (
|
|
22
|
+
pack: PackageManager,
|
|
23
|
+
command: CommanderModule.Command,
|
|
24
|
+
prompt: (
|
|
25
|
+
opt?: InquirerModule.StreamOptions,
|
|
26
|
+
) => InquirerModule.PromptModule,
|
|
27
|
+
action: (
|
|
28
|
+
closure: (options: Partial<T>) => Promise<T>,
|
|
29
|
+
) => Promise<T>,
|
|
30
|
+
) => Promise<T>,
|
|
31
|
+
): Promise<T> => {
|
|
32
|
+
// INSTALL TEMPORARY PACKAGES
|
|
33
|
+
const newbie = {
|
|
34
|
+
commander: pack.install({
|
|
35
|
+
dev: true,
|
|
36
|
+
modulo: "commander",
|
|
37
|
+
version: "10.0.0",
|
|
38
|
+
silent: true,
|
|
39
|
+
}),
|
|
40
|
+
inquirer: pack.install({
|
|
41
|
+
dev: true,
|
|
42
|
+
modulo: "inquirer",
|
|
43
|
+
version: "8.2.5",
|
|
44
|
+
silent: true,
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// LOAD INSTALLED MODULES
|
|
49
|
+
const { program: command }: typeof CommanderModule = await import(
|
|
50
|
+
path.join(pack.directory, "node_modules", "commander")
|
|
51
|
+
);
|
|
52
|
+
const { createPromptModule: prompt }: typeof InquirerModule =
|
|
53
|
+
await import(
|
|
54
|
+
path.join(pack.directory, "node_modules", "inquirer")
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// TAKE OPTIONS
|
|
58
|
+
const action = (closure: (options: Partial<T>) => Promise<T>) =>
|
|
59
|
+
new Promise<T>((resolve, reject) => {
|
|
60
|
+
command.action(async (options) => {
|
|
61
|
+
try {
|
|
62
|
+
resolve(await closure(options));
|
|
63
|
+
} catch (exp) {
|
|
64
|
+
reject(exp);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
command.parseAsync().catch(reject);
|
|
68
|
+
});
|
|
69
|
+
const output: T | Error = await (async () => {
|
|
70
|
+
try {
|
|
71
|
+
return await inquiry(pack, command, prompt, action);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
return error as Error;
|
|
74
|
+
}
|
|
75
|
+
})();
|
|
76
|
+
|
|
77
|
+
// REMOVE TEMPORARY PACKAGES
|
|
78
|
+
if (erase === true) {
|
|
79
|
+
if (newbie.commander)
|
|
80
|
+
pack.erase({ modulo: "commander", silent: true });
|
|
81
|
+
if (newbie.inquirer)
|
|
82
|
+
pack.erase({ modulo: "inquirer", silent: true });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// RETURNS
|
|
86
|
+
if (output instanceof Error) throw output;
|
|
87
|
+
return output;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -2,18 +2,19 @@ import type Comment from "comment-json";
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { TypiaSetupWizard } from "../TypiaSetupWizard";
|
|
6
6
|
import { PackageManager } from "./PackageManager";
|
|
7
7
|
|
|
8
8
|
export namespace PluginConfigurator {
|
|
9
9
|
export async function configure(
|
|
10
10
|
pack: PackageManager,
|
|
11
|
-
args:
|
|
11
|
+
args: TypiaSetupWizard.IArguments,
|
|
12
12
|
): Promise<void> {
|
|
13
13
|
// INSTALL COMMENT-JSON
|
|
14
14
|
const installed: boolean = pack.install({
|
|
15
15
|
dev: true,
|
|
16
16
|
modulo: "comment-json",
|
|
17
|
+
version: "4.2.3",
|
|
17
18
|
silent: true,
|
|
18
19
|
});
|
|
19
20
|
|
|
@@ -38,7 +39,7 @@ export namespace PluginConfigurator {
|
|
|
38
39
|
|
|
39
40
|
async function _Configure(
|
|
40
41
|
pack: PackageManager,
|
|
41
|
-
args:
|
|
42
|
+
args: TypiaSetupWizard.IArguments,
|
|
42
43
|
): Promise<void> {
|
|
43
44
|
// GET COMPILER-OPTIONS
|
|
44
45
|
const Comment: typeof import("comment-json") = await import(
|
package/src/executable/typia.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { CommandExecutor } from "./internal/CommandExecutor";
|
|
4
|
-
import { PackageManager } from "./internal/PackageManager";
|
|
5
|
-
import { PluginConfigurator } from "./internal/PluginConfigurator";
|
|
2
|
+
import { TypiaSetupWizard } from "./TypiaSetupWizard";
|
|
6
3
|
|
|
7
4
|
const USAGE = `Wrong command has been detected. Use like below:
|
|
8
5
|
|
|
@@ -21,46 +18,9 @@ function halt(desc: string): never {
|
|
|
21
18
|
process.exit(-1);
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
async function setup(): Promise<void> {
|
|
25
|
-
console.log("----------------------------------------");
|
|
26
|
-
console.log(" Typia Setup Wizard");
|
|
27
|
-
console.log("----------------------------------------");
|
|
28
|
-
|
|
29
|
-
// LOAD PACKAGE.JSON INFO
|
|
30
|
-
const pack: PackageManager = await PackageManager.mount();
|
|
31
|
-
|
|
32
|
-
// TAKE ARGUMENTS
|
|
33
|
-
const args: ArgumentParser.IArguments = await ArgumentParser.parse(pack);
|
|
34
|
-
|
|
35
|
-
// INSTALL TYPESCRIPT
|
|
36
|
-
pack.install({ dev: true, modulo: "typescript" });
|
|
37
|
-
args.project ??= (() => {
|
|
38
|
-
CommandExecutor.run("npx tsc --init", false);
|
|
39
|
-
return (args.project = "tsconfig.json");
|
|
40
|
-
})();
|
|
41
|
-
pack.install({ dev: true, modulo: "ts-node" });
|
|
42
|
-
|
|
43
|
-
// INSTALL COMPILER
|
|
44
|
-
pack.install({ dev: true, modulo: args.compiler });
|
|
45
|
-
if (args.compiler === "ts-patch") {
|
|
46
|
-
await pack.save((data) => {
|
|
47
|
-
data.scripts ??= {};
|
|
48
|
-
if (typeof data.scripts.prepare === "string")
|
|
49
|
-
data.scripts.prepare =
|
|
50
|
-
"ts-patch install && " + data.scripts.prepare;
|
|
51
|
-
else data.scripts.prepare = "ts-patch install";
|
|
52
|
-
});
|
|
53
|
-
CommandExecutor.run("npm run prepare", false);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// INSTALL AND CONFIGURE TYPIA
|
|
57
|
-
pack.install({ dev: false, modulo: "typia" });
|
|
58
|
-
await PluginConfigurator.configure(pack, args);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
21
|
async function main(): Promise<void> {
|
|
62
22
|
const type: string | undefined = process.argv[2];
|
|
63
|
-
if (type === "setup") await setup();
|
|
23
|
+
if (type === "setup") await TypiaSetupWizard.setup();
|
|
64
24
|
else halt(USAGE);
|
|
65
25
|
}
|
|
66
26
|
main().catch((exp) => {
|
package/src/module.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Namespace } from "./functional/Namespace";
|
|
|
3
3
|
import { IMetadataApplication } from "./metadata/IMetadataApplication";
|
|
4
4
|
import { IJsonApplication } from "./schemas/IJsonApplication";
|
|
5
5
|
|
|
6
|
+
import { IRandomGenerator } from "./IRandomGenerator";
|
|
6
7
|
import { IValidation } from "./IValidation";
|
|
7
8
|
import { Primitive } from "./Primitive";
|
|
8
9
|
import { TypeGuardError } from "./TypeGuardError";
|
|
@@ -10,9 +11,10 @@ import { TypeGuardError } from "./TypeGuardError";
|
|
|
10
11
|
export * from "./schemas/IJsonApplication";
|
|
11
12
|
export * from "./schemas/IJsonComponents";
|
|
12
13
|
export * from "./schemas/IJsonSchema";
|
|
14
|
+
export * from "./IRandomGenerator";
|
|
15
|
+
export * from "./IValidation";
|
|
13
16
|
export * from "./Primitive";
|
|
14
17
|
export * from "./TypeGuardError";
|
|
15
|
-
export * from "./IValidation";
|
|
16
18
|
|
|
17
19
|
/* ===========================================================
|
|
18
20
|
SINGLE FUNCTIONS
|
|
@@ -853,11 +855,12 @@ export function metadata(): never {
|
|
|
853
855
|
* would be generated instead.
|
|
854
856
|
*
|
|
855
857
|
* @template T Type of data to generate
|
|
858
|
+
* @param generator Random data generator
|
|
856
859
|
* @return Randomly generated data
|
|
857
860
|
*
|
|
858
861
|
* @author Jeongho Nam - https://github.com/samchon
|
|
859
862
|
*/
|
|
860
|
-
export function random(): never;
|
|
863
|
+
export function random(generator?: Partial<IRandomGenerator>): never;
|
|
861
864
|
|
|
862
865
|
/**
|
|
863
866
|
* Generate random data.
|
|
@@ -870,11 +873,12 @@ export function random(): never;
|
|
|
870
873
|
* would be generated instead.
|
|
871
874
|
*
|
|
872
875
|
* @template T Type of data to generate
|
|
876
|
+
* @param generator Random data generator
|
|
873
877
|
* @return Randomly generated data
|
|
874
878
|
*
|
|
875
879
|
* @author Jeongho Nam - https://github.com/samchon
|
|
876
880
|
*/
|
|
877
|
-
export function random<T>(): Primitive<T>;
|
|
881
|
+
export function random<T>(generator?: Partial<IRandomGenerator>): Primitive<T>;
|
|
878
882
|
|
|
879
883
|
/**
|
|
880
884
|
* @internal
|
|
@@ -1466,12 +1470,12 @@ export function createIsParse(): never;
|
|
|
1466
1470
|
*
|
|
1467
1471
|
* @author Jeongho Nam - https://github.com/samchon
|
|
1468
1472
|
*/
|
|
1469
|
-
export function createIsParse<T>(): (input: string) => T | null;
|
|
1473
|
+
export function createIsParse<T>(): (input: string) => Primitive<T> | null;
|
|
1470
1474
|
|
|
1471
1475
|
/**
|
|
1472
1476
|
* @internal
|
|
1473
1477
|
*/
|
|
1474
|
-
export function createIsParse<T>(): (input: string) => T | null {
|
|
1478
|
+
export function createIsParse<T>(): (input: string) => Primitive<T> | null {
|
|
1475
1479
|
halt("createIsParse");
|
|
1476
1480
|
}
|
|
1477
1481
|
Object.assign(createIsParse, isParse);
|
|
@@ -1495,12 +1499,12 @@ export function createAssertParse(): never;
|
|
|
1495
1499
|
*
|
|
1496
1500
|
* @author Jeongho Nam - https://github.com/samchon
|
|
1497
1501
|
*/
|
|
1498
|
-
export function createAssertParse<T>(): (input: string) => T
|
|
1502
|
+
export function createAssertParse<T>(): (input: string) => Primitive<T>;
|
|
1499
1503
|
|
|
1500
1504
|
/**
|
|
1501
1505
|
* @internal
|
|
1502
1506
|
*/
|
|
1503
|
-
export function createAssertParse<T>(): (input: string) => T {
|
|
1507
|
+
export function createAssertParse<T>(): (input: string) => Primitive<T> {
|
|
1504
1508
|
halt("createAssertParse");
|
|
1505
1509
|
}
|
|
1506
1510
|
Object.assign(createAssertParse, assertParse);
|
|
@@ -1524,12 +1528,16 @@ export function createValidateParse(): never;
|
|
|
1524
1528
|
*
|
|
1525
1529
|
* @author Jeongho Nam - https://github.com/samchon
|
|
1526
1530
|
*/
|
|
1527
|
-
export function createValidateParse<T>(): (
|
|
1531
|
+
export function createValidateParse<T>(): (
|
|
1532
|
+
input: string,
|
|
1533
|
+
) => IValidation<Primitive<T>>;
|
|
1528
1534
|
|
|
1529
1535
|
/**
|
|
1530
1536
|
* @internal
|
|
1531
1537
|
*/
|
|
1532
|
-
export function createValidateParse<T>(): (
|
|
1538
|
+
export function createValidateParse<T>(): (
|
|
1539
|
+
input: string,
|
|
1540
|
+
) => IValidation<Primitive<T>> {
|
|
1533
1541
|
halt("createValidateParse");
|
|
1534
1542
|
}
|
|
1535
1543
|
Object.assign(createValidateParse, validateParse);
|
|
@@ -1661,22 +1669,26 @@ Object.assign(createValidateStringify, validateStringify);
|
|
|
1661
1669
|
* Creates a reusable {@link random} function.
|
|
1662
1670
|
*
|
|
1663
1671
|
* @danger You have to specify the generic argument `T`
|
|
1672
|
+
* @param generator Random data generator
|
|
1664
1673
|
* @return Nothing until specifying the generic argument `T`
|
|
1665
1674
|
* @throws compile error
|
|
1666
1675
|
*
|
|
1667
1676
|
* @author Jeongho Nam - https://github.com/samchon
|
|
1668
1677
|
*/
|
|
1669
|
-
export function createRandom(): never;
|
|
1678
|
+
export function createRandom(generator?: Partial<IRandomGenerator>): never;
|
|
1670
1679
|
|
|
1671
1680
|
/**
|
|
1672
1681
|
* Creates a resuable {@link random} function.
|
|
1673
1682
|
*
|
|
1674
1683
|
* @template T Type of the input value
|
|
1684
|
+
* @param generator Random data generator
|
|
1675
1685
|
* @returns A reusable `random` function
|
|
1676
1686
|
*
|
|
1677
1687
|
* @author Jeongho Nam - https://github.com/samchon
|
|
1678
1688
|
*/
|
|
1679
|
-
export function createRandom<T>(
|
|
1689
|
+
export function createRandom<T>(
|
|
1690
|
+
generator?: Partial<IRandomGenerator>,
|
|
1691
|
+
): () => Primitive<T>;
|
|
1680
1692
|
|
|
1681
1693
|
/**
|
|
1682
1694
|
* @internal
|