Skip to content

Conversation

@michsa
Copy link
Contributor

@michsa michsa commented Mar 4, 2020

  • Add optionLens - a higher-order lens like includeLens, but for selection of mutually exclusive options instead of membership in a set (ie. optionLens is to radio lists as includeLens is to checkbox lists)
  • Add arrayLens stub (it seemed left out, since we have stubs for object and function lenses)

@michsa michsa requested review from daedalus28 and stellarhoof March 4, 2020 16:21
@michsa michsa self-assigned this Mar 4, 2020
@decrapifier
Copy link
Contributor

decrapifier commented Mar 4, 2020

Warnings
⚠️ You should add at least 1 more reviewer to the PR
Messages
📖 Your PR has no browser errors. Great job!

Generated by 🚫 dangerJS against 242f3d9

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`
Copy link
Member

@stellarhoof stellarhoof Mar 4, 2020

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?

Copy link
Contributor Author

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 🤔

Copy link
Contributor Author

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)

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

Successfully merging this pull request may close these issues.

5 participants