@dereekb/util 12.1.10 → 12.1.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.
@@ -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 searchParams = new URLSearchParams(mergedInput);
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
  }
@@ -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 searchParams = new URLSearchParams(mergedInput);
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
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/fetch",
3
- "version": "12.1.10",
3
+ "version": "12.1.12",
4
4
  ".": {
5
5
  "types": "./src/index.d.ts",
6
6
  "node": {
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "12.1.10",
3
+ "version": "12.1.12",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
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.12](https://github.com/dereekb/dbx-components/compare/v12.1.11...v12.1.12) (2025-06-19)
6
+
7
+
8
+
9
+ ## [12.1.11](https://github.com/dereekb/dbx-components/compare/v12.1.10...v12.1.11) (2025-06-17)
10
+
11
+
12
+
5
13
  ## [12.1.10](https://github.com/dereekb/dbx-components/compare/v12.1.9...v12.1.10) (2025-06-13)
6
14
 
7
15
 
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "12.1.10",
3
+ "version": "12.1.12",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "@dereekb/util": "*"