Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an alter/convert function to modify a snowball #90

Open
RayBenefield opened this issue Jan 6, 2018 · 0 comments
Open

Add an alter/convert function to modify a snowball #90

RayBenefield opened this issue Jan 6, 2018 · 0 comments
Assignees

Comments

@RayBenefield
Copy link
Owner

RayBenefield commented Jan 6, 2018

A common pattern I've noticed is:

transmute({ roar: 'test' })
	.extend('afterChange', snowball =>
		func({ ...snowball, differentName: snowball.roar })
	)

It should be something more like:

transmute({ roar: 'test' })
	.extend('afterChange',
		alter('roar', 'differentName')(func)
    )
transmute({ roar: 'test', dude: 'stuff' })
	.extend('afterChange',
		alter(
			['roar', 'dude'],
			['differentName', 'betterName'],
			func
		)
    )

Maybe... might be powerful. Not really a fan of the syntax yet, but would be interesting. Alternatively a solid thing would be a babel plugin that allows this:

transmute({ roar: 'test' })
	.extend('afterChange', (snowball: { roar: differentName }) =>
		func({ ...snowball, differentName })
	)

Destructuring on positional arguments. Just some thoughts.

@RayBenefield RayBenefield self-assigned this Jan 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant