Replies: 1 comment
-
This is not supported 😞 but it could be 😁 It would be pretty easy to add support for, just an object that partials all the functions and adds a Two downsides I'm thinking of... If we use const chain = <TData> (data: TData) => ({
max: partial(max, data)
})
// Note: We would export chain as default so you could do _(gods)
chain(gods).max(g => g.rank) So we'd have to retype every function in the chain object. This sucks a bit because contributors/maintainers would have to make sure the chain is updated when the function actual changed. const chain = <TData> (data: TData) => ({
max: <T extends number | object>(
getter?: (item: T) => number
) => max(data, getter)
})
chain(gods).max(g => g.rank) The other downside, a bit related, is that the tests would have to be duplicated as well. I still think chaining would be great though! I'm curious how much people want this. If a PR was made I would certainly consider it. |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I wonder if
radash
supports the same explicit/implicit method chaining as supported bylodash
?I tries in the playground but seems implicit chaining is failed:
with
Beta Was this translation helpful? Give feedback.
All reactions