Dry property set (pipe JS object to setters )

Hello,

I looking for a way to dry my code a bit. Imagine that I have a record, and I want to set several properties using setters. Is there a way to do this without repeating over and over again the object being setted ? Imagin I have this record

[@bs.deriving abstract]
type prefs = {
  mutable user: string,
  mutable pass: string,
  mutable env: string
};

Then imagine I want to set both the user and pass, the only way I can think of is this

   prefs -> userSet ("joe")
   prefs -> passSet ("big")

I was expecting to use something like pipe operator, or something like with or that stuff. Is that even possible ?
Another problem of repetitive code I’m having is related to this same topic but having the string to set contained on a option. I want to extract the string if it is some and just ignore it otherwhise. Using map seems to be the best possible way, but that forces me to pipe it to ignore because I’m mapping a function that returns unit.

  Belt.Option.map (Env.get("RANCHER_USER"), prefs -> userSet) |> ignore;
  Belt.Option.map (Env.get("RANCHER_PASS"), prefs -> passSet) |> ignore;

This is better than pattern match every option, but still a bit of repetitive.
Thanks for your advise !