@ringcentral/sdk
Version:
- [Installation](#installation) - [Getting Started](#getting-started) - [API Calls](#api-calls) - [Advanced SDK Configuration & Polyfills](#advanced-sdk-configuration--polyfills) - [Making telephony calls](#making-telephony-calls) - [Call mana
17 lines (15 loc) • 572 B
text/typescript
function encodeURIComponentWithUndefined(value) {
return typeof value === 'undefined' ? '' : encodeURIComponent(value);
}
export function objectToUrlParams(obj) {
return Object.keys(obj)
.map(key => {
if (Array.isArray(obj[key])) {
return obj[key]
.map(value => encodeURIComponent(key) + '=' + encodeURIComponentWithUndefined(value))
.join('&');
}
return encodeURIComponent(key) + '=' + encodeURIComponentWithUndefined(obj[key]);
})
.join('&');
}