<commit_before>"use strict";

var assert = require("assert");

var BaseView = function BaseView(options) {
  assert(options.parent, "View requires parent");
  assert(options.layoutConfig, "View requires layoutConfig option");

  this.parent = options.parent;
  this.layoutConfig = options.layoutConfig;

  this.parent.screen.on("resize", this.recalculatePosition.bind(this));
};

BaseView.prototype.getPosition = function () {
  return this.layoutConfig.getPosition(this.parent);
};

BaseView.prototype.recalculatePosition = function () {
  this.node.position = this.getPosition();
};

BaseView.prototype.setLayout = function (layoutConfig) {
  this.layoutConfig = layoutConfig;
  this.node.position = this.getPosition();
};

module.exports = BaseView;<commit_msg>require getPosition function in base view<commit_after>"use strict";

var assert = require("assert");
var _ = require("lodash");

var BaseView = function BaseView(options) {
  assert(options.parent, "View requires parent");
  assert(options.layoutConfig && _.isFunction(options.layoutConfig.getPosition),
    "View requires layoutConfig option with getPosition function");

  this.parent = options.parent;
  this.layoutConfig = options.layoutConfig;

  this.parent.screen.on("resize", this.recalculatePosition.bind(this));
};

BaseView.prototype.getPosition = function () {
  return this.layoutConfig.getPosition(this.parent);
};

BaseView.prototype.recalculatePosition = function () {
  this.node.position = this.getPosition();
};

BaseView.prototype.setLayout = function (layoutConfig) {
  this.layoutConfig = layoutConfig;
  this.recalculatePosition();
};

module.exports = BaseView;
{'fraction_non_alphanumeric': 0.13090909090909092, 'fraction_numerical': 0.0, 'mean_word_length': 5.657258064516129, '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': '1422129', 'n_tokens_mistral': 473, 'n_tokens_neox': 466, 'n_words': 91}