Encapsulate Record

refactorgram

organization = {name: “Acme Gooseberries”, country: “GB”};

image/svg+xml

class Organization {
  constructor(data) {
    this._name = data.name;
    this._country = data.country;
  }
  get name()    {return this._name;}
  set name(arg) {this._name = arg;}
  get country()    {return this._country;}
  set country(arg) {this._country = arg;}
}

aliases Replace Record with Data Class