`assemble` does not return the same length as its transforming functions
Closed this issue · 4 comments
Curried assemble does not return a function with the same length as its transforming functions. This is a problem when the length of the function is used to determine how to call a function (react-redux
)
const myFunction = (one, two) => { ... }
myFunction.length // 2
const myAssembly = assemble({
myValue: myFunction,
})
myAssembly.length // 1
I wouldn't mind taking a crack at this. @mgreystone or @flintinatux do y'all already have a solution in the works, or is it open?
I haven't worked on it. The only thought that I have is to recursively inspect the transform object (it can be deeply nested), and then curryN
the resulting function. I know Ramda
does a decent job of setting the length correctly if you curryN
.
See: https://github.com/ramda/ramda/blob/master/source/curryN.js#L53
If you get a working solution, it may be appropriate to apply it to assembleP
also.
I have a fix in my head, pretty much along the lines of what @flintinatux said. This is pretty low in our list priorities, though.
I bring it up & find it relevant because it is the cause of some not-super-clear redux bugs. That said, I'll think on it on my own time