Open fregante opened 9 months ago
Do you even need the Object.entries
? You haven't told what tokenBody
is.
> new URLSearchParams(Object.entries({a: 1}))
URLSearchParams { 'a' => '1' }
> new URLSearchParams({a: 1})
URLSearchParams { 'a' => '1' }
Judging by MDN, that's seems to be accepted. I think the problem used to be typescript, but that works now too
https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/URLSearchParams
Objects are not iterable
Right, so URLSearchParams
is special in that it accepts objects, but the basic idea is the same in all cases, avoid a loop when a constructor can do the looping itself.
Accepted. prefer-iterable-in-constructor
Description
It might be a bit niche, but not everyone knows that you can convert an object to a URLSearchParams without a for loop.
Fail
Pass
Additional Info
No response