teableio/teable

View on GitHub
packages/sdk/src/utils/urlParams.ts

Summary

Maintainability
A
0 mins
Test Coverage
export function addQueryParamsToWebSocketUrl(url: string, params: Record<string, string>) {
  const urlObj = new URL(url);

  Object.keys(params).forEach((key) => {
    urlObj.searchParams.set(key, params[key]);
  });

  return urlObj.toString();
}