@aneuhold/core-ts-db-lib 1.0.11 → 1.0.12
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function isOptionalObject(value: unknown): value is undefined | object;
|
|
2
|
-
export declare function isOptionalArray(value: unknown): value is undefined | Array<unknown
|
|
3
|
-
export declare function isOptionalString(value: unknown): value is undefined | string;
|
|
4
|
-
export declare function isOptionalNumber(value: unknown): value is undefined | number;
|
|
5
|
-
export declare function isOptionalBoolean(value: unknown): value is undefined | boolean;
|
|
2
|
+
export declare function isOptionalArray(value: unknown): value is undefined | Array<unknown> | null;
|
|
3
|
+
export declare function isOptionalString(value: unknown): value is undefined | string | null;
|
|
4
|
+
export declare function isOptionalNumber(value: unknown): value is undefined | null | number;
|
|
5
|
+
export declare function isOptionalBoolean(value: unknown): value is undefined | null | boolean;
|
|
6
6
|
//# sourceMappingURL=commonTypeGuards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonTypeGuards.d.ts","sourceRoot":"","sources":["../../../src/schemas/type-guards/commonTypeGuards.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,GAAG,MAAM,CAE5E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"commonTypeGuards.d.ts","sourceRoot":"","sources":["../../../src/schemas/type-guards/commonTypeGuards.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,GAAG,MAAM,CAE5E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAE5C;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG,MAAM,GAAG,IAAI,CAEpC;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG,IAAI,GAAG,MAAM,CAEpC;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG,IAAI,GAAG,OAAO,CAErC"}
|
|
@@ -6,18 +6,18 @@ function isOptionalObject(value) {
|
|
|
6
6
|
}
|
|
7
7
|
exports.isOptionalObject = isOptionalObject;
|
|
8
8
|
function isOptionalArray(value) {
|
|
9
|
-
return value === undefined || Array.isArray(value);
|
|
9
|
+
return value === undefined || value === null || Array.isArray(value);
|
|
10
10
|
}
|
|
11
11
|
exports.isOptionalArray = isOptionalArray;
|
|
12
12
|
function isOptionalString(value) {
|
|
13
|
-
return value === undefined || typeof value === 'string';
|
|
13
|
+
return value === undefined || value === null || typeof value === 'string';
|
|
14
14
|
}
|
|
15
15
|
exports.isOptionalString = isOptionalString;
|
|
16
16
|
function isOptionalNumber(value) {
|
|
17
|
-
return value === undefined || typeof value === 'number';
|
|
17
|
+
return value === undefined || value === null || typeof value === 'number';
|
|
18
18
|
}
|
|
19
19
|
exports.isOptionalNumber = isOptionalNumber;
|
|
20
20
|
function isOptionalBoolean(value) {
|
|
21
|
-
return value === undefined || typeof value === 'boolean';
|
|
21
|
+
return value === undefined || value === null || typeof value === 'boolean';
|
|
22
22
|
}
|
|
23
23
|
exports.isOptionalBoolean = isOptionalBoolean;
|
|
@@ -94,7 +94,7 @@ class Validate {
|
|
|
94
94
|
}
|
|
95
95
|
let currentObject = this.parentObject;
|
|
96
96
|
for (let i = 0; i < fieldPath.length - 1; i += 1) {
|
|
97
|
-
if (currentObject[fieldPath[i]]
|
|
97
|
+
if (typeof currentObject[fieldPath[i]] !== 'object') {
|
|
98
98
|
return false;
|
|
99
99
|
}
|
|
100
100
|
currentObject = currentObject[fieldPath[i]];
|