<commit_before>import Viewport from '../viewports/viewport';
import assert from 'assert';

export default class View {
  constructor(props) {
    Object.assign(this, props);
    assert(!this.viewportInstance || this.viewportInstance instanceof Viewport);
    Object.seal();
  }

  equals(newView) {
    if (newView === this) {
      return true;
    }
    // If a viewportInstance is supplied, it is the only thing that is used
    // `View` hiearchy supports an `equals` method
    if (newView.viewportInstance) {
      return this.viewport && this.viewport.equals(newView.viewportInstance);
    }
    // TODO - implement deep equal on view descriptors
    return false;
  }

  // Build a `Viewport` from a view descriptor
  // TODO - add support for autosizing viewports using width and height
  makeViewport({width, height}) {<commit_msg>fix View.equals (#1383)<commit_after>import Viewport from '../viewports/viewport';
import assert from 'assert';

export default class View {
  constructor(props) {
    Object.assign(this, props);
    assert(!this.viewportInstance || this.viewportInstance instanceof Viewport);
    Object.seal();
  }

  equals(newView) {
    if (newView === this) {
      return true;
    }
    // If a viewportInstance is supplied, it is the only thing that is used
    // `View` hiearchy supports an `equals` method
    if (newView.viewportInstance) {
      return this.viewportInstance && this.viewportInstance.equals(newView.viewportInstance);
    }
    // TODO - implement deep equal on view descriptors
    return false;
  }

  // Build a `Viewport` from a view descriptor
  // TODO - add support for autosizing viewports using width and height
  makeViewport({width, height}) {
{'fraction_non_alphanumeric': 0.10421545667447307, 'fraction_numerical': 0.00234192037470726, 'mean_word_length': 3.3375634517766497, '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': '3270391', 'n_tokens_mistral': 491, 'n_tokens_neox': 480, 'n_words': 158}