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

Generic "in" operator #43

Open
tlrobinson opened this issue Nov 6, 2019 · 1 comment
Open

Generic "in" operator #43

tlrobinson opened this issue Nov 6, 2019 · 1 comment

Comments

@tlrobinson
Copy link
Contributor

tlrobinson commented Nov 6, 2019

I find assocIn etc to be useful, and sometimes wish similar functions existed for the other functions. Here's a prototype of an at (because in is a reserved word) function and chain method that let you apply any operator to a path:

https://runkit.com/tlrobinson/5dc341aa7f9859001a1b54f4

e.x.

icepick.at(object, ["foo", "bar"]).push(4)

icepick.chain(object)
  .at(["foo", "bar"]).push(4)
  .at(["new", "object"]).assoc(5)
  .at(["new", "array"]).push(6)
  .value()
@aearly
Copy link
Owner

aearly commented Nov 10, 2019

I like this feature, seems very handy. Seems like it could be implemented similarly to .chain() too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants