Official | var mixinQuery = Object.assign({}, targetParams, extraParams)
var sortedParams = Object.keys(mixinQuery).sort()
var charRegex = /[!'\(\)*]/g
var mixinParams = []
for (var i = 0; i < sortedParams.length; i++) {
var key = sortedParams[i]
var value = mixinQuery[key]
if (value && typeof value === 'string') {
value = value.replace(charRegex, '')
}
if (value != null) {
mixinParams.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)))
}
}
var sortedParamsStr = mixinParams.join('&')
| ready |
Unofficial 1 | const mixedQuery = {
...targetParams,
...extraParams,
}
const sortedParams = Object.keys(mixedQuery).sort()
const reg = /[!'\(\)*]/g
const mixedParams = []
for (let i = sortedParams.length - 1; i >= 0; --i) {
const key = sortedParams[i]
const value = mixedQuery[key]
mixedParams[i] =
key !== 'wts'
? `${encodeURIComponent(key)}=${encodeURIComponent(value.replace(reg, ''))}`
: `${key}=${value}`
}
const result = mixedParams.join('&')
| ready |
Unofficial 2 | const formattedTargetParams = []
const targetParamsKeys = Object.keys(targetParams)
for (let i = targetParamsKeys.length - 1; i >= 0; --i) {
const key = targetParamsKeys[i]
formattedTargetParams[i] = `${key}=${encodeURIComponent(targetParams[key].replace(reg, ''))}`
}
const mixedParams = formattedTargetParams.concat(extraParams2).sort().join('&')
| ready |
Unofficial 3 | const formattedTargetParams = []
const targetParamsKeys = Object.keys(targetParams)
for (let i = targetParamsKeys.length - 1; i >= 0; --i) {
const key = targetParamsKeys[i]
formattedTargetParams.push(`${key}=${encodeURIComponent(
targetParams[key].replace(reg, '')
)}`)
}
const mixedParams = formattedTargetParams.concat(extraParams2).sort().join('&')
| ready |
Unofficial 4 | const result = []
const targetParamsKeys = Object.keys(targetParams)
for (let i = targetParamsKeys.length - 1; i >= 0; --i) {
const key = targetParamsKeys[i]
result.push(`${key}=${encodeURIComponent(
targetParams[key].replace(reg, '')
)}`)
}
result.push(...extraParams2)
const mixedParams = result.sort().join('&')
| ready |