<commit_before>import { o_create } from "oasis/shims";

function assert(assertion, string) {
  if (!assertion) {
    throw new Error(string);
  }
}

function mustImplement(className, name) {
  return function() {
    throw new Error("Subclasses of " + className + " must implement " + name);
  };
}

function extend(parent, object) {
  function OasisObject() {
    parent.apply(this, arguments);
    if (this.initialize) {
      this.initialize.apply(this, arguments);
    }
  }

  OasisObject.prototype = o_create(parent.prototype);

  for (var prop in object) {
    if (!object.hasOwnProperty(prop)) { continue; }
    OasisObject.prototype[prop] = object[prop];
  }

  return OasisObject;
}

function rsvpErrorHandler(error) {
  if (typeof console === 'object' && console.assert && console.error) {
    // chrome does not (yet) link the URLs in `console.assert`
    console.error(error.stack);
    console.assert(false, error.message);
  }
  // throw an error upstream for tests & browsers without `console.assert`
  setTimeout( function () { throw error; }, 1);
  // also throw an error sync. to cascade promise failure
  throw error;
}

export { assert, extend, mustImplement, rsvpErrorHandler };<commit_msg>ensure error is thrown on it's own line<commit_after>import { o_create } from "oasis/shims";

function assert(assertion, string) {
  if (!assertion) {
    throw new Error(string);
  }
}

function mustImplement(className, name) {
  return function() {
    throw new Error("Subclasses of " + className + " must implement " + name);
  };
}

function extend(parent, object) {
  function OasisObject() {
    parent.apply(this, arguments);
    if (this.initialize) {
      this.initialize.apply(this, arguments);
    }
  }

  OasisObject.prototype = o_create(parent.prototype);

  for (var prop in object) {
    if (!object.hasOwnProperty(prop)) { continue; }
    OasisObject.prototype[prop] = object[prop];
  }

  return OasisObject;
}

function rsvpErrorHandler(error) {
  if (typeof console === 'object' && console.assert && console.error) {
    // chrome does not (yet) link the URLs in `console.assert`
    console.error(error.stack);
    console.assert(false, error.message);
  }
  // throw an error upstream for tests & browsers without `console.assert`
  setTimeout( function () {
    throw error;
  }, 1);
  // also throw an error sync. to cascade promise failure
  throw error;
}

export { assert, extend, mustImplement, rsvpErrorHandler };
{'fraction_non_alphanumeric': 0.127442996742671, 'fraction_numerical': 0.0008143322475570033, 'mean_word_length': 3.725, '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': '2082181', 'n_tokens_mistral': 758, 'n_tokens_neox': 742, 'n_words': 207}