<commit_before>var fitter = require('canvas-fit')
var loop = require('raf-loop')

module.exports = function(canvas, opt) {
  opt = opt||{}
  
  var fit = fitter(canvas, opt.parent, opt.scale)
  var app = loop()
  var shape = [0, 0]

  resize()

  window.addEventListener('resize', function() {
    resize()
    app.emit('resize')
  }, false)

  Object.defineProperties(app, {
    scale: {
      get: function() {
        return fit.scale
      },
      set: function(s) {
        fit.scale = s
      }
    },
    shape: {
      get: function() {
        return shape
      }
    },
    parent: {
      get: function() {
        return fit.parent<commit_msg>improve error messaging<commit_after>var fitter = require('canvas-fit')
var loop = require('raf-loop')

module.exports = function(canvas, opt) {
  if (!canvas) throw new TypeError('must specify a canvas element')
  opt = opt||{}
  var fit = fitter(canvas, opt.parent, opt.scale)
  var app = loop()
  var shape = [0, 0]

  resize()

  window.addEventListener('resize', function() {
    resize()
    app.emit('resize')
  }, false)

  Object.defineProperties(app, {
    scale: {
      get: function() {
        return fit.scale
      },
      set: function(s) {
        fit.scale = s
      }
    },
    shape: {
      get: function() {
        return shape
      }
    },
    parent: {
      get: function() {
        return fit.parent
{'fraction_non_alphanumeric': 0.14614830813534918, 'fraction_numerical': 0.0028797696184305254, 'mean_word_length': 2.2552693208430914, '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': '5761617', 'n_tokens_mistral': 453, 'n_tokens_neox': 437, 'n_words': 108}