Replies: 1 comment
-
This is very helpful, thank you for sharing! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using Flop in my Phoenix API, and have a frontend in Svelte. I quickly found a need for some helper functions in Javascript that allow creating the query parameters needed by Flop more easily.
I started from the source code of
map_to_filter_params/2
and ported it to TypeScript. I also wrote some tests that cover all my use cases, but there could definitely be more of them. This implementation gives me full vscode autocomplete and type safety for an object of an any custom type. See usage in examples and tests below.I hope someone finds this useful, and figured if you wanted to distribute this as
flop-js
on npm in the future, you could use this as a starting point.Tests:
Beta Was this translation helpful? Give feedback.
All reactions