@dereekb/util 12.1.11 → 12.1.13
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/fetch/index.cjs.js +4 -2
- package/fetch/index.esm.js +5 -3
- package/fetch/package.json +1 -1
- package/fetch/src/lib/fetch.url.d.ts +6 -0
- package/package.json +1 -1
- package/src/lib/misc/color.d.ts +6 -0
- package/src/lib/misc/index.d.ts +1 -0
- package/test/CHANGELOG.md +8 -0
- package/test/package.json +1 -1
package/fetch/index.cjs.js
CHANGED
|
@@ -2951,10 +2951,12 @@ async function iterateFetchPages(config) {
|
|
|
2951
2951
|
*/
|
|
2952
2952
|
function makeUrlSearchParams(input, options) {
|
|
2953
2953
|
const {
|
|
2954
|
-
omitKeys
|
|
2954
|
+
omitKeys,
|
|
2955
|
+
filterNullAndUndefinedValues: filterValues = true
|
|
2955
2956
|
} = options ?? {};
|
|
2956
2957
|
const mergedInput = Array.isArray(input) ? util.mergeObjects(input) : input;
|
|
2957
|
-
const
|
|
2958
|
+
const filteredInput = filterValues ? util.filterNullAndUndefinedValues(mergedInput ?? {}) : mergedInput;
|
|
2959
|
+
const searchParams = new URLSearchParams(filteredInput);
|
|
2958
2960
|
if (omitKeys != null) {
|
|
2959
2961
|
util.useIterableOrValue(omitKeys, key => searchParams.delete(key), false);
|
|
2960
2962
|
}
|
package/fetch/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { removeTrailingSlashes, asGetter, multiValueMapBuilder, filterMaybeArrayValues, isWebsiteUrlWithPrefix, fixMultiSlashesInSlashPath, isPromiseLike, cachedGetter, FIRST_PAGE, performAsyncTasks, mapIdentityFunction, performTasksFromFactoryInParallelFunction, mergeObjects, useIterableOrValue, isEmptyIterable, fixExtraQueryParameters, forEachInIterable, isIterable, forEachKeyValue } from '@dereekb/util';
|
|
1
|
+
import { removeTrailingSlashes, asGetter, multiValueMapBuilder, filterMaybeArrayValues, isWebsiteUrlWithPrefix, fixMultiSlashesInSlashPath, isPromiseLike, cachedGetter, FIRST_PAGE, performAsyncTasks, mapIdentityFunction, performTasksFromFactoryInParallelFunction, mergeObjects, filterNullAndUndefinedValues, useIterableOrValue, isEmptyIterable, fixExtraQueryParameters, forEachInIterable, isIterable, forEachKeyValue } from '@dereekb/util';
|
|
2
2
|
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
|
|
@@ -2949,10 +2949,12 @@ async function iterateFetchPages(config) {
|
|
|
2949
2949
|
*/
|
|
2950
2950
|
function makeUrlSearchParams(input, options) {
|
|
2951
2951
|
const {
|
|
2952
|
-
omitKeys
|
|
2952
|
+
omitKeys,
|
|
2953
|
+
filterNullAndUndefinedValues: filterValues = true
|
|
2953
2954
|
} = options ?? {};
|
|
2954
2955
|
const mergedInput = Array.isArray(input) ? mergeObjects(input) : input;
|
|
2955
|
-
const
|
|
2956
|
+
const filteredInput = filterValues ? filterNullAndUndefinedValues(mergedInput ?? {}) : mergedInput;
|
|
2957
|
+
const searchParams = new URLSearchParams(filteredInput);
|
|
2956
2958
|
if (omitKeys != null) {
|
|
2957
2959
|
useIterableOrValue(omitKeys, key => searchParams.delete(key), false);
|
|
2958
2960
|
}
|
package/fetch/package.json
CHANGED
|
@@ -7,6 +7,12 @@ export interface MakeUrlSearchParamsOptions {
|
|
|
7
7
|
* Optional iterable of keys to remove from the search params.
|
|
8
8
|
*/
|
|
9
9
|
readonly omitKeys?: Maybe<IterableOrValue<ObjectKey>>;
|
|
10
|
+
/**
|
|
11
|
+
* Whether to filter out null and undefined values from the input objects.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to true.
|
|
14
|
+
*/
|
|
15
|
+
readonly filterNullAndUndefinedValues?: boolean;
|
|
10
16
|
}
|
|
11
17
|
/**
|
|
12
18
|
* Creates URLSearchParams from the input objects. The input objects are merged together.
|
package/package.json
CHANGED
package/src/lib/misc/index.d.ts
CHANGED
package/test/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [12.1.13](https://github.com/dereekb/dbx-components/compare/v12.1.12-dev...v12.1.13) (2025-06-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [12.1.12](https://github.com/dereekb/dbx-components/compare/v12.1.11...v12.1.12) (2025-06-19)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
5
13
|
## [12.1.11](https://github.com/dereekb/dbx-components/compare/v12.1.10...v12.1.11) (2025-06-17)
|
|
6
14
|
|
|
7
15
|
|