justus 0.0.4 → 0.0.7
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 +35 -0
- package/dist/dts-generator.js +13 -17
- package/dist/dts-generator.js.map +1 -1
- package/dist/dts-generator.mjs +4 -1
- package/dist/dts-generator.mjs.map +1 -1
- package/dist/index.js +34 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -6
- package/dist/index.mjs.map +1 -1
- package/index.d.ts +54 -42
- package/package.json +10 -10
- package/src/dts-generator.ts +5 -1
- package/src/errors.ts +1 -1
- package/src/index.ts +21 -9
- package/src/schema.ts +6 -6
- package/src/types.ts +9 -7
- package/src/validators/array.ts +3 -3
- package/src/validators/date.ts +3 -3
- package/src/validators/number.ts +5 -5
- package/src/validators/object.ts +13 -6
- package/src/validators/string.ts +5 -5
- package/src/validators/tuple.ts +1 -1
- package/src/validators/union.ts +3 -3
- package/src/validators/url.ts +4 -3
package/src/validators/union.ts
CHANGED
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
Validator,
|
|
8
8
|
} from '../types'
|
|
9
9
|
|
|
10
|
-
type UnionArguments = readonly [ Validation, ...Validation[] ]
|
|
10
|
+
export type UnionArguments = readonly [ Validation, ...Validation[] ]
|
|
11
11
|
|
|
12
12
|
/* -------------------------------------------------------------------------- */
|
|
13
13
|
|
|
14
|
-
type InferOneOfValidationType<A extends UnionArguments> =
|
|
14
|
+
export type InferOneOfValidationType<A extends UnionArguments> =
|
|
15
15
|
A extends readonly [ infer First, ...infer Rest ] ?
|
|
16
16
|
First extends Validation ?
|
|
17
17
|
Rest extends UnionArguments ?
|
|
@@ -49,7 +49,7 @@ export function oneOf<A extends UnionArguments>(...args: A): OneOfValidator<A> {
|
|
|
49
49
|
|
|
50
50
|
/* -------------------------------------------------------------------------- */
|
|
51
51
|
|
|
52
|
-
type InferAllOfValidationType<A extends UnionArguments> =
|
|
52
|
+
export type InferAllOfValidationType<A extends UnionArguments> =
|
|
53
53
|
A extends readonly [ infer First, ...infer Rest ] ?
|
|
54
54
|
First extends Validation ?
|
|
55
55
|
Rest extends UnionArguments ?
|
package/src/validators/url.ts
CHANGED
|
@@ -21,6 +21,7 @@ const KEYS: Exclude<keyof URLConstraints, 'searchParams'>[] = [
|
|
|
21
21
|
const OPTIONS: ValidationOptions = {
|
|
22
22
|
stripAdditionalProperties: false,
|
|
23
23
|
stripForbiddenProperties: false,
|
|
24
|
+
stripOptionalNulls: false,
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/** Constraints to validate a `URL` with. */
|
|
@@ -129,10 +130,10 @@ export class URLValidator extends Validator<URL> {
|
|
|
129
130
|
|
|
130
131
|
const anyURLValidator = new URLValidator()
|
|
131
132
|
|
|
132
|
-
function _url(): URLValidator
|
|
133
|
-
function _url(constraints: URLConstraints): URLValidator
|
|
133
|
+
export function _url(): URLValidator
|
|
134
|
+
export function _url(constraints: URLConstraints): URLValidator
|
|
134
135
|
|
|
135
|
-
function _url(constraints?: URLConstraints): URLValidator {
|
|
136
|
+
export function _url(constraints?: URLConstraints): URLValidator {
|
|
136
137
|
return constraints ? new URLValidator(constraints) : anyURLValidator
|
|
137
138
|
}
|
|
138
139
|
|