react-shallow-testutils icon indicating copy to clipboard operation
react-shallow-testutils copied to clipboard

Flipping argument order

Open DerekMaffett opened this issue 10 years ago • 0 comments

Thanks for making these tools - we've been finding them particularly useful on our project.

Have you considered the idea of flipping and currying the arguments to encourage more reusable and composable functions? If the interface was something like this:

ShallowTestUtils.findWithType(type, component);

This would be more in the pattern of functional libraries like Ramda (http://ramdajs.com/0.17/index.html). It would also allow more fine-grained functions if they were curried:

const getButton = ShallowTestUtils.findWithType('button');

It would also permit compositions of these functions to query specific paths of a tree.

pipe(getSpecialDiv, getList, getListItem, getButton)(component)

I'd be happy to work on this.

DerekMaffett avatar Oct 08 '15 01:10 DerekMaffett