| 284 | const defEqCodes = [61]; // = |
| 285 | |
| 286 | function addKeyVal(obj, key, value, keyEncoded, valEncoded, decode) { |
| 287 | if (key.length > 0 && keyEncoded) |
| 288 | key = decodeStr(key, decode); |
| 289 | if (value.length > 0 && valEncoded) |
| 290 | value = decodeStr(value, decode); |
| 291 | |
| 292 | if (obj[key] === undefined) { |
| 293 | obj[key] = value; |
| 294 | } else { |
| 295 | const curValue = obj[key]; |
| 296 | // A simple Array-specific property check is enough here to |
| 297 | // distinguish from a string value and is faster and still safe |
| 298 | // since we are generating all of the values being assigned. |
| 299 | if (curValue.pop) |
| 300 | curValue[curValue.length] = value; |
| 301 | else |
| 302 | obj[key] = [curValue, value]; |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | /** |
| 307 | * Parse a key/val string. |