@germondai/ts-utils 0.0.3 → 0.0.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/dist/module.js CHANGED
@@ -248,11 +248,12 @@ var buildUrl = (baseUrl, path, queryParams) => {
248
248
  const normalizedPath = path.startsWith("/") ? path : `/${path}`;
249
249
  url.pathname = `${url.pathname.replace(/\/$/, "")}${normalizedPath}`;
250
250
  }
251
- if (queryParams) {
251
+ if (queryParams)
252
252
  Object.entries(queryParams).forEach(([key, value]) => {
253
- url.searchParams.set(key, String(value));
253
+ if (value === undefined)
254
+ return;
255
+ url.searchParams.set(key, value === null ? "" : String(value));
254
256
  });
255
- }
256
257
  return url.toString();
257
258
  };
258
259
  export {
@@ -46,4 +46,4 @@ export declare const removeQueryParam: (urlString: string, key: string) => strin
46
46
  * // returns 'https://example.com/api/v1/resource?search=test&page=2'
47
47
  * buildUrl('https://example.com', '/api/v1/resource', { search: 'test', page: 2 });
48
48
  */
49
- export declare const buildUrl: (baseUrl: string, path?: string, queryParams?: Record<string, string | number | boolean>) => string;
49
+ export declare const buildUrl: (baseUrl: string, path?: string, queryParams?: Record<string, string | number | boolean | null | undefined>) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@germondai/ts-utils",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Germond's TypeScript Utilities",
5
5
  "repository": {
6
6
  "type": "git",