DanielFGray – 20-58 Jan 8
im using a library with an api like
foo.method(...args).run(pool)
and i want to abstract it so i dont need to add .run(pool)
to every call..
whats the best way to approach this, without having to change anything to the usage except for removing the .run(pool)
?
is a proxy useful here, or is there something else that doesnt require maintaining a list of methods on the original object?8 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
im not sure how currying would help here, can you give an example?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
that would work if i knew what method to use ahead of time, but there are many and i dont want to map them in my own object
i want to allow all possible methods without having to code them in my own object
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Types are another matter, I want to replicate the same API
foo[method](...args)
without needing an object with every method
Pretty sure I need a proxy for this 🤔Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1061750790068371487