Skip to content

Commit

Permalink
PropTypes.Prop: add :=? for Optional Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
nafg committed Jun 29, 2020
1 parent 1bcf631 commit bb0783b
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ object PropTypes {

class Prop[A](val name: String)(implicit writer: Writer[A]) {
def :=(value: A): Setting = new Setting(name, writer.write(value))
def :=?(value: Option[A]): Setting = new Setting(name, value.map(writer.write).getOrElse(js.undefined))
}

trait WithChildren[C] extends PropTypes {
Expand Down

0 comments on commit bb0783b

Please sign in to comment.