-
Notifications
You must be signed in to change notification settings - Fork 71
More lenses 🕶 #316
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
base: master
Are you sure you want to change the base?
More lenses 🕶 #316
Conversation
| 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` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This signature doesn't match the usage in the test: F.optionLens('a', 'selected', object)
Also shouldn't this be under domLens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(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)
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)