Open
Conversation
Contributor
stellarhoof
reviewed
Mar 4, 2020
| An include lens represents membership of a value in a set. It takes a value and lens and returns a new lens - kind of like a "writeable computed" from MobX or Knockout. The view and set functions allow you to read and write a boolean value for whether or not a value is in an array. If you change to true or false, it will set the underlying array lens with a new array either without the value or with it pushed at the end. | ||
|
|
||
| #### optionLens | ||
| `value -> arrayLens -> optionLens` |
Member
There was a problem hiding this comment.
This signature doesn't match the usage in the test: F.optionLens('a', 'selected', object)
Also shouldn't this be under domLens?
Contributor
Author
There was a problem hiding this comment.
it's not a dom lens, it's a higher-order lens - it belongs in the same category as includeLens, since it's the same kind of thing.
And yeah, you're right. I just copied the signature from includeLens, but I guess it's wrong for both 🤔
Contributor
Author
There was a problem hiding this comment.
(the difference, to clarify, is that the higher-order lenses includeLens and optionLens take a lens and return a lens, while the domLens methods take a lens and return an object mapping DOM properties to functions that manipulate the lens)
daedalus28
reviewed
Mar 5, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
optionLens- a higher-order lens likeincludeLens, but for selection of mutually exclusive options instead of membership in a set (ie.optionLensis to radio lists asincludeLensis to checkbox lists)arrayLensstub (it seemed left out, since we have stubs for object and function lenses)