make-service
make-service copied to clipboard
Make addQueryToURL more full featured
I'd like to construct a QS as complex as 'filter[0]["key"]=value&filter[0]["op"]=gte&filter[0]["value"]=0' out of an object like:
addQueryToURL(`http://localhost:3000`, { filter: [{ key: "value", op: "gte", value: 0 }] });
What do you think about having something like this: 'filter["key"]=value&filter["op"]=gte&filter["value"]=0? There might be a specific reason for how you're positioning the filters, and if that's the case, please let me know.
How would you expect those filters to appear in the url response?
Hey @Mario-aj, thank you for showing interest!
There's no pattern when it comes to this problem. That is why Id rather follow the same behavior as the qs library. It is also the exact inverse of composable-functions' inputFromSearch if you'd like to see a smaller code.
Hey @gustavoguichard, thanks for the recommendation! I'll definitely check out these libraries.