typia 3.7.1-dev.20230405 → 3.7.1-dev.20230406

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.
Files changed (2) hide show
  1. package/README.md +28 -28
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,16 +7,11 @@
7
7
 
8
8
  ```typescript
9
9
  // RUNTIME VALIDATORS
10
- export function is<T>(input: unknown | T): input is T; // returns boolean
11
- export function assert<T>(input: unknown | T): T; // throws TypeGuardError
12
- export function validate<T>(input: unknown | T): IValidation<T>; // detailed
10
+ export function is<T>(input: unknown): input is T; // returns boolean
11
+ export function assert<T>(input: unknown): T; // throws TypeGuardError
12
+ export function validate<T>(input: unknown): IValidation<T>; // detailed
13
13
  export const customValidators: CustomValidatorMap; // can add custom validators
14
14
 
15
- // STRICT VALIDATORS
16
- export function equals<T>(input: unknown | T): input is T;
17
- export function assertEquals<T>(input: unknown | T): T;
18
- export function validateEquals<T>(input: unknown | T): IValidation<T>;
19
-
20
15
  // JSON
21
16
  export function application<T>(): IJsonApplication; // JSON schema
22
17
  export function assertParse<T>(input: string): T; // type safe parser
@@ -25,7 +20,7 @@ export function assertStringify<T>(input: T): string; // safe and faster
25
20
  // +) stringify, isStringify, validateStringify
26
21
 
27
22
  // MISC
28
- export function random<T>(g?: IRandomGenerator): Primitive<T>; // random data
23
+ export function random<T>(g?: Partial<IRandomGenerator>): Primitive<T>;
29
24
  export function clone<T>(input: T): Primitive<T>; // deep clone
30
25
  export function prune<T extends object>(input: T): void; // erase extra props
31
26
  // +) isClone, assertClone, validateClone
@@ -41,7 +36,7 @@ export function prune<T extends object>(input: T): void; // erase extra props
41
36
 
42
37
  All functions in `typia` require **only one line**. You don't need any extra dedication like JSON schema definitions or decorator function calls. Just call `typia` function with only one line like `typia.assert<T>(input)`.
43
38
 
44
- Also, as `typia` performs AOT (Ahead of Time) compilation skill, its performance is much faster than other competitive libaries. For an example, when comparing validate function `is()` with other competitive libraries, `typia` is maximum **15,000x times faster** than `class-validator`.
39
+ Also, as `typia` performs AOT (Ahead of Time) compilation skill, its performance is much faster than other competitive libaries. For an example, when comparing validate function `is()` with other competitive libraries, `typia` is maximum **15,000x faster** than `class-validator`.
45
40
 
46
41
  ![Is Function Benchmark](https://github.com/samchon/typia/raw/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz/images/is.svg)
47
42
 
@@ -172,26 +167,26 @@ For more details, refer to the [Guide Documents (wiki)](https://github.com/samch
172
167
  > - [comment tags](https://github.com/samchon/typia/wiki/Runtime-Validators#comment-tags)
173
168
  > - [custom validators](https://github.com/samchon/typia/wiki/Runtime-Validators#custom-validators)
174
169
  > - **Enhanced JSON**
175
- > - [JSON schema](https://github.com/samchon/typia/wiki/Enhanced-JSON#json-schema)
176
- > - [`parse()` functions](https://github.com/samchon/typia/wiki/Enhanced-JSON#parse-functions)
177
170
  > - [`stringify()` functions](https://github.com/samchon/typia/wiki/Enhanced-JSON#stringify-functions)
171
+ > - [`parse()` functions](https://github.com/samchon/typia/wiki/Enhanced-JSON#parse-functions)
172
+ > - [JSON schema](https://github.com/samchon/typia/wiki/Enhanced-JSON#json-schema)
178
173
  > - [comment tags](https://github.com/samchon/typia/wiki/Enhanced-JSON#comment-tags)
179
- > - **Miscellaneous**
180
- > - [`random()` function](https://github.com/samchon/typia/wiki/Miscellaneous#random-function)
181
- > - [`clone()` functions](https://github.com/samchon/typia/wiki/Miscellaneous#clone-functions)
182
- > - [`prune()` functions](https://github.com/samchon/typia/wiki/Miscellaneous#prune-functions)
174
+ > - **Random Generator**
175
+ > - [`random()` function](https://github.com/samchon/typia/wiki/Random-Generator#random-function)
176
+ > - [comment tags](https://github.com/samchon/typia/wiki/Random-Geneerator#comment-tags)
177
+ > - [customization](https://github.com/samchon/typia/wiki/Random-Generator#customization)
183
178
 
184
179
  ### Runtime Validators
185
180
  ```typescript
186
181
  // ALLOW SUPERFLUOUS PROPERTIES
187
- export function is<T>(input: T | unknown): input is T; // returns boolean
188
- export function assert<T>(input: T | unknown): T; // throws `TypeGuardError`
189
- export function validate<T>(input: T | unknown): IValidation<T>; // detailed
182
+ export function is<T>(input: unknown): input is T; // returns boolean
183
+ export function assert<T>(input: unknown): T; // throws `TypeGuardError`
184
+ export function validate<T>(input: unknown): IValidation<T>; // detailed
190
185
 
191
186
  // DO NOT ALLOW SUPERFLUOUS PROPERTIES
192
- export function equals<T>(input: T | unknown): input is T;
193
- export function assertEquals<T>(input: T | unknown): T;
194
- export function validateEquals<T>(input: T | unknown): IValidation<T>;
187
+ export function equals<T>(input: unknown): input is T;
188
+ export function assertEquals<T>(input: unknown): T;
189
+ export function validateEquals<T>(input: unknown): IValidation<T>;
195
190
 
196
191
  // REUSABLE FACTORY FUNCTIONS
197
192
  export function createIs<T>(): (input: unknown) => input is T;
@@ -211,14 +206,14 @@ export const customValidators: CustomValidatorMap;
211
206
  - `assert()`: throws a [`TypeGuardError`](https://github.com/samchon/typia/blob/master/src/TypeGuardError.ts) when not matched
212
207
  - `validate()`
213
208
  - when matched, returns [`IValidation.ISuccess<T>`](https://github.com/samchon/typia/blob/master/src/IValidation.ts) with `value` property
214
- - when not matched, returns [`IValidation.IFailure`](https://github.com/samchon/typia/blob/master/src/IValidation.ts) with `errors` property
209
+ - otherwise not matched, returns [`IValidation.IFailure`](https://github.com/samchon/typia/blob/master/src/IValidation.ts) with `errors` property
215
210
 
216
211
  Also, if you want more strict validator functions that even do not allowing superfluous properties not written in the type `T`, you can use those functions instead; `equals()`, `assertEquals()`, `validateEquals()`. Otherwise you want to create resuable validator functions, you can utilize factory functions like `createIs()` instead.
217
212
 
218
213
  When you want to add special validation logics, like limiting range of numeric values, you can do it through comment tags. Furthermore, you can add your custom validator logics. If you want to know about them, visit the Guide Documents:
219
214
 
220
215
  - [Features > Runtime Validators > Comment Tags](https://github.com/samchon/typia/wiki/Runtime-Validators#comment-tags)
221
- - [Features > Runtime Validators > Custom Validators](https://github.com/samchon/typia/wiki/Runtime-Validators#comment-tags).
216
+ - [Features > Runtime Validators > Custom Validators](https://github.com/samchon/typia/wiki/Runtime-Validators#custom-validators).
222
217
 
223
218
  ### Enhanced JSON
224
219
  ```typescript
@@ -262,17 +257,20 @@ export function createAssertStringify<T>(): (input: T) => string;
262
257
 
263
258
  ### Miscellaneous
264
259
  ```typescript
265
- export function random<T>(): Primitive<T>; // random data generator
260
+ // random data generator
261
+ export function random<T>(g?: Partial<IRandomGenerator>): Primitive<T>;
266
262
  export function clone<T>(input: T): Primitive<T>; // deep copy
267
263
  export function prune<T>(input: T): void; // remove superfluous properties
268
264
  // +) isClone, assertClone, validateClone
269
265
  // +) isPrune, assertPrune, validatePrune
270
266
  ```
271
267
 
272
- When you need test data, just generate it through `typia.random<T>()`.
268
+ When you need random data, just call only `typia.random<T>()` function.
273
269
 
274
- If a little bit special data being required, use ([Features > Runtime Validators > Comment Tags](https://github.com/samchon/typia/wiki/Runtime-Validators#comment-tags))
270
+ If you need specific random data generation, utilize comment tags or do customize.
275
271
 
272
+ - [Features > Random Generator > comment tags](https://github.com/samchon/typia/wiki/Random-Generator#random-function)
273
+ - [Features > Random Generator > customization](https://github.com/samchon/typia/wiki/Random-Generator#customization)
276
274
 
277
275
 
278
276
 
@@ -286,7 +284,9 @@ If a little bit special data being required, use ([Features > Runtime Validators
286
284
 
287
285
  [Nestia](https://github.com/samchon/nestia) is a set of helper libraries for `NestJS`, supporting below features:
288
286
 
289
- - `@nestia/core`: **15,000x times faster** validation decorators
287
+ - `@nestia/core`: superfast decorators using `typia`
288
+ - **15,000x faster** validation
289
+ - **100x faster** JSON serialization
290
290
  - `@nestia/sdk`: evolved **SDK** and **Swagger** generators
291
291
  - SDK (Software Development Kit)
292
292
  - interaction library for client developers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typia",
3
- "version": "3.7.1-dev.20230405",
3
+ "version": "3.7.1-dev.20230406",
4
4
  "description": "Superfast runtime validators with only one line",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",