Travis build: 1611

This commit is contained in:
30secondsofcode
2019-12-09 10:56:20 +00:00
parent 2c830d8a6f
commit b26bc18ec3
15 changed files with 875 additions and 873 deletions

View File

@ -10,14 +10,13 @@ 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;
}, '')
: '';
};
```