@tstdl/base 0.88.3 → 0.88.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/http/client/http-client.js +2 -2
- package/package.json +1 -1
- package/utils/merge.js +3 -3
- package/utils/object/object.js +2 -2
- package/utils/type-guards.d.ts +0 -6
- package/utils/type-guards.js +1 -8
|
@@ -15,7 +15,7 @@ import { encodeUtf8 } from '../../utils/encoding.js';
|
|
|
15
15
|
import { composeAsyncMiddleware } from '../../utils/middleware.js';
|
|
16
16
|
import { objectEntries } from '../../utils/object/object.js';
|
|
17
17
|
import { readableStreamFromPromise } from '../../utils/stream/readable-stream-from-promise.js';
|
|
18
|
-
import {
|
|
18
|
+
import { isDefined, isObject, isUndefined } from '../../utils/type-guards.js';
|
|
19
19
|
import { buildUrl } from '../../utils/url-builder.js';
|
|
20
20
|
import { HttpHeaders } from '../http-headers.js';
|
|
21
21
|
import { HttpError, HttpErrorReason } from '../http.error.js';
|
|
@@ -284,7 +284,7 @@ function mapParameters(request, baseUrl) {
|
|
|
284
284
|
if (request.mapParametersToQuery) {
|
|
285
285
|
for (const entry of parameterEntries) {
|
|
286
286
|
const [parameter, value] = entry;
|
|
287
|
-
if (isUndefined(value) ||
|
|
287
|
+
if (isUndefined(value) || isObject(value)) {
|
|
288
288
|
continue;
|
|
289
289
|
}
|
|
290
290
|
for (const val of toArray(value)) {
|
package/package.json
CHANGED
package/utils/merge.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
2
|
-
import { assertArray,
|
|
2
|
+
import { assertArray, assertMap, assertObject, assertSet, isArray, isMap, isObject, isSet, isUndefined } from './type-guards.js';
|
|
3
3
|
export function merge(a, b) {
|
|
4
4
|
if (isUndefined(a)) {
|
|
5
5
|
return b;
|
|
@@ -7,8 +7,8 @@ export function merge(a, b) {
|
|
|
7
7
|
if (isUndefined(b)) {
|
|
8
8
|
return a;
|
|
9
9
|
}
|
|
10
|
-
if (
|
|
11
|
-
|
|
10
|
+
if (isObject(a)) {
|
|
11
|
+
assertObject(b, 'Cannot merge object into non-object.');
|
|
12
12
|
return { ...a, ...b };
|
|
13
13
|
}
|
|
14
14
|
else if (isArray(a)) {
|
package/utils/object/object.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { filterAsync } from '../async-iterable-helpers/filter.js';
|
|
2
2
|
import { mapAsync } from '../async-iterable-helpers/map.js';
|
|
3
3
|
import { toArrayAsync } from '../async-iterable-helpers/to-array.js';
|
|
4
|
-
import { isDefined, isObject, isSymbol, isUndefined } from '../type-guards.js';
|
|
4
|
+
import { isArray, isDefined, isObject, isSymbol, isUndefined } from '../type-guards.js';
|
|
5
5
|
export function hasOwnProperty(obj, key) {
|
|
6
6
|
return Object.hasOwn(obj, key);
|
|
7
7
|
}
|
|
@@ -90,7 +90,7 @@ export function deepObjectEntries(object, keepInnerObjects = false, prefix) {
|
|
|
90
90
|
: allEntries.map(([key, value]) => [`${prefix}${key}`, value]);
|
|
91
91
|
const entries = [];
|
|
92
92
|
for (const [key, value] of rawEntries) {
|
|
93
|
-
if (isObject(value)) {
|
|
93
|
+
if (isObject(value) || isArray(value)) {
|
|
94
94
|
if (keepInnerObjects) {
|
|
95
95
|
entries.push([key, value]);
|
|
96
96
|
}
|
package/utils/type-guards.d.ts
CHANGED
|
@@ -78,12 +78,6 @@ export declare const assertSymbol: AssertFunction<symbol>;
|
|
|
78
78
|
export declare const assertNotSymbol: AssertNotFunction<symbol>;
|
|
79
79
|
export declare const assertSymbolPass: AssertPassFunction<symbol>;
|
|
80
80
|
export declare const assertNotSymbolPass: AssertNotPassFunction<symbol>;
|
|
81
|
-
export declare const isLiteralObject: IsFunction<object>;
|
|
82
|
-
export declare const isNotLiteralObject: IsNotFunction<object>;
|
|
83
|
-
export declare const assertLiteralObject: AssertFunction<object>;
|
|
84
|
-
export declare const assertNotLiteralObject: AssertNotFunction<object>;
|
|
85
|
-
export declare const assertLiteralObjectPass: AssertPassFunction<object>;
|
|
86
|
-
export declare const assertNotLiteralObjectPass: AssertNotPassFunction<object>;
|
|
87
81
|
export declare const isObject: IsFunction<object>;
|
|
88
82
|
export declare const isNotObject: IsNotFunction<object>;
|
|
89
83
|
export declare const assertObject: AssertFunction<object>;
|
package/utils/type-guards.js
CHANGED
|
@@ -104,14 +104,7 @@ export const assertSymbol = symbolGuards.assertSymbol;
|
|
|
104
104
|
export const assertNotSymbol = symbolGuards.assertNotSymbol;
|
|
105
105
|
export const assertSymbolPass = symbolGuards.assertSymbolPass;
|
|
106
106
|
export const assertNotSymbolPass = symbolGuards.assertNotSymbolPass;
|
|
107
|
-
const
|
|
108
|
-
export const isLiteralObject = literalObjectGuards.isLiteralObject;
|
|
109
|
-
export const isNotLiteralObject = literalObjectGuards.isNotLiteralObject;
|
|
110
|
-
export const assertLiteralObject = literalObjectGuards.assertLiteralObject;
|
|
111
|
-
export const assertNotLiteralObject = literalObjectGuards.assertNotLiteralObject;
|
|
112
|
-
export const assertLiteralObjectPass = literalObjectGuards.assertLiteralObjectPass;
|
|
113
|
-
export const assertNotLiteralObjectPass = literalObjectGuards.assertNotLiteralObjectPass;
|
|
114
|
-
const objectGuards = createGuards('object', (value) => (typeof value == 'object') && (value != null));
|
|
107
|
+
const objectGuards = createGuards('object', (value) => (typeof value == 'object') && (value != null) && (Reflect.getPrototypeOf(value) == Object.prototype) && (Reflect.getPrototypeOf(value).constructor == Object));
|
|
115
108
|
export const isObject = objectGuards.isObject;
|
|
116
109
|
export const isNotObject = objectGuards.isNotObject;
|
|
117
110
|
export const assertObject = objectGuards.assertObject;
|