@furystack/rest
Advanced tools
Comparing version 5.0.5 to 5.0.6
{ | ||
"name": "@furystack/rest", | ||
"version": "5.0.5", | ||
"version": "5.0.6", | ||
"description": "Generic REST package", | ||
@@ -40,11 +40,11 @@ "type": "module", | ||
"dependencies": { | ||
"@furystack/core": "^12.0.5", | ||
"@furystack/inject": "^8.0.5" | ||
"@furystack/core": "^12.0.6", | ||
"@furystack/inject": "^8.0.6" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.2.5", | ||
"typescript": "^5.0.4", | ||
"vitest": "^0.31.4" | ||
"@types/node": "^20.4.2", | ||
"typescript": "^5.1.6", | ||
"vitest": "^0.33.0" | ||
}, | ||
"gitHead": "1045d854bfd8c475b7035471d130d401417a2321" | ||
} |
@@ -30,16 +30,19 @@ export const tryDecodeQueryParam = (queryParam: any) => { | ||
const dedupedValues = entries | ||
.reduce((prev, current) => { | ||
const currentKey = current[0] | ||
const currentValue = tryDecodeQueryParam(current[1]) | ||
const existing = prev.find(([key]) => key === currentKey) | ||
if (existing) { | ||
existing[1] instanceof Array ? existing[1].push(currentValue) : (existing[1] = currentValue) | ||
return [...prev] | ||
} | ||
const newValue = [currentKey, currentKey.includes('[]') ? [currentValue] : currentValue] as [ | ||
string, | ||
string | string[], | ||
] | ||
return [...prev, newValue] | ||
}, [] as Array<[string, string | string[]]>) | ||
.reduce( | ||
(prev, current) => { | ||
const currentKey = current[0] | ||
const currentValue = tryDecodeQueryParam(current[1]) | ||
const existing = prev.find(([key]) => key === currentKey) | ||
if (existing) { | ||
existing[1] instanceof Array ? existing[1].push(currentValue) : (existing[1] = currentValue) | ||
return [...prev] | ||
} | ||
const newValue = [currentKey, currentKey.includes('[]') ? [currentValue] : currentValue] as [ | ||
string, | ||
string | string[], | ||
] | ||
return [...prev, newValue] | ||
}, | ||
[] as Array<[string, string | string[]]>, | ||
) | ||
.map(([key, value]) => [key.replace('[]', ''), value]) | ||
@@ -46,0 +49,0 @@ |
export class RequestError extends Error { | ||
constructor(msg: string, public responseCode: number) { | ||
constructor( | ||
msg: string, | ||
public responseCode: number, | ||
) { | ||
super(msg) | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46189
406
Updated@furystack/core@^12.0.6
Updated@furystack/inject@^8.0.6