-
Notifications
You must be signed in to change notification settings - Fork 36
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
lensing objects: L.merge? #73
Comments
(Replying with a mobile.) Hmm... Could you give an example of what you have in mind? |
L.merge(['foo'], { b: 2, c: 3 }, { foo: { a: 1, b: 0 } }); // { foo: { a: 1, b: 2, c: 3 } } That is to say, I'm imagining an existing object structure to get updated based on the values in the provided object. |
Hmm... How about this: L.modify('foo', R.merge(R.__, { b: 2, c: 3 }), { foo: { a: 1, b: 0 } })
// { foo: { a: 1, b: 2, c: 3 } } |
Well, that works. Thanks! :) |
With PR #104 one could say: L.assign('foo', { b: 2, c: 3 }, { foo: { a: 1, b: 0 } })
// { foo: { a: 1, b: 2, c: 3 } } |
Thanks for the follow-up! That's awesome, looks like object manipulation just got more pleasant. :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the spirit of (batch)
upsert
, I wonder if, not unlikeL.append
for updating existing arrays, writing to existing objects might have use for something likeL.merge
(just a lens equivalent ofR.merge
).There might be more, but this just stood out to me as a more likely addition to flesh things out.
The text was updated successfully, but these errors were encountered: