Travis build: 1553

This commit is contained in:
30secondsofcode
2019-11-06 17:28:06 +00:00
parent c9dadc5450
commit 99cd824e03
16 changed files with 1646 additions and 493 deletions

View File

@ -10,13 +10,14 @@ Determine the `symbol` to be either `?` or `&` based on the `index` and concaten
Return the `queryString` or an empty string when the `queryParameters` are falsy.
```js
const objectToQueryString = queryParameters => {
return queryParameters
? Object.entries(queryParameters).reduce((queryString, [key, val], index) => {
const symbol = index === 0 ? '?' : '&';
queryString += typeof val === 'string' ? `${symbol}${key}=${val}` : '';
return queryString;
}, '')
const symbol = index === 0 ? '?' : '&';
queryString += typeof val === 'string' ? `${symbol}${key}=${val}` : '';
return queryString;
}, '')
: '';
};
```