<commit_before>import * as Url from './url';
import * as Title from './title';
import * as Description from './description';

export { Url, Title, Description };

class BookmarkFields {
  constructor(url, title, description) {
    if (!Url.assertType(url)) {
      throw new TypeError('Expected:Url');
    }

    if (!Title.assertType(title)) {
      throw new TypeError('Expected:Title');
    }

    if (!(description === null || Description.assertType(description))) {
      throw new TypeError('Expected:Description');
    }

    this.url = url;
    this.title = title;
    this.description = description;
    return Object.freeze(this);
  }

  toObject() {
    return {
      url: this.url,
      title: this.title,
      description: this.description
    };
  }
<commit_msg>Make fields use getter/setter instead of constructor validation<commit_after>import * as Url from './url';
import * as Title from './title';
import * as Description from './description';

export { Url, Title, Description };

class BookmarkFields {
  constructor(url, title, description) {
    this.url = url;
    this.title = title;
    this.description = description;
  }

  set url(url) {
    if (!Url.assertType(url)) {
      throw new TypeError('Expected:Url');
    }

    this._url = url;
  }

  get url() {
    return this._url;
  }

  set title(title) {
    if (!Title.assertType(title)) {
      throw new TypeError('Expected:Title');
    }

    this._title = title;
  }

  get title() {
    return this._title;
  }

  set description(description) {
    if (!(description === null || Description.assertType(description))) {
      throw new TypeError('Expected:Description');
    }

    this._description = description;
  }

  get description() {
    return this._description;
  }

  toObject() {
    return {
      url: this.url,
      title: this.title,
      description: this.description
    };
  }

{'fraction_non_alphanumeric': 0.13559322033898305, 'fraction_numerical': 0.0, 'mean_word_length': 2.8629856850715747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4135480', 'n_tokens_mistral': 567, 'n_tokens_neox': 552, 'n_words': 143}