<commit_before>import assign from './assign';
/**
 * Property Descriptor that computes its value once and then permanently caches
 * the result.
 *
 * In order to make the computation of microstate properties easy to
 * reason about, we want them to be as lazy as possible. However, in
 * order to make sure that we don't do any extra computation than
 * necessary we want to permanently cache the result of those lazy
 * computations. That's where `ComputedProperty` comes in.
 *
 * Every instance of `ComputedProperty` is a valid instance of a
 * JavaScript property descriptor, which, by default,  is
 * is _not_ enumerable. It can be used in any API that expects a property
 * descriptor. For example:
 *
 *   let object = {};
 *   Object.defineProperty('constant', new ComputedProperty(function() {
 *     return {};
 *   }))
 *
 *   object.constant === object.constant //=> true
 *
 * In order to change the configuration of the property descriptor,
 * you can pass a set of overrides to the constructor to do things
 * like make it an enumerable property.
 *
 *   let object = {}
 *   Object.defineProperty('constant', new ComputedProperty(function() {
 *     return {}
 *   }, { enumerable: true }));
 *
 *   Object.keys(object) //=> ['constant']
 *
 * The value of `this` inside the computed property evaluation function will be
 * the object on which this property resides.
 *
 *   let object = {one: 1, two: 2};
 *   Object.defineProperty('info', new ComputedProperty(function() {
 *     return { type: typeof this, keys: Object.keys(this) };
 *   }));
 *
 *   object.info //=> { type: 'object', keys: ['one', 'two'] }
 *
 * Note that it's totally ok to permanently cache the results of computations
 * since the objects to which these properties will be attached are
 * immutable.
 *
 * @constructor ComputedProperty
 * @param {function} compute - evaluates the property value
 * @param {Object} [attributes] - extra attributes for the descriptor.
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty#Description
 */
export default class ComputedProperty {
  get writeable() { return false; }

  get enumerable() { return false; }

  constructor(compute, attributes = {}) {
    let property = this;
    this.get = function() {
      let value = compute.call(this);
      property.get = ()=> value;
      return value;
    };
    assign(this, attributes);
  }
}<commit_msg>fix node 6<commit_after>import assign from './assign';
/**
 * Property Descriptor that computes its value once and then permanently caches
 * the result.
 *
 * In order to make the computation of microstate properties easy to
 * reason about, we want them to be as lazy as possible. However, in
 * order to make sure that we don't do any extra computation than
 * necessary we want to permanently cache the result of those lazy
 * computations. That's where `ComputedProperty` comes in.
 *
 * Every instance of `ComputedProperty` is a valid instance of a
 * JavaScript property descriptor, which, by default,  is
 * is _not_ enumerable. It can be used in any API that expects a property
 * descriptor. For example:
 *
 *   let object = {};
 *   Object.defineProperty('constant', new ComputedProperty(function() {
 *     return {};
 *   }))
 *
 *   object.constant === object.constant //=> true
 *
 * In order to change the configuration of the property descriptor,
 * you can pass a set of overrides to the constructor to do things
 * like make it an enumerable property.
 *
 *   let object = {}
 *   Object.defineProperty('constant', new ComputedProperty(function() {
 *     return {}
 *   }, { enumerable: true }));
 *
 *   Object.keys(object) //=> ['constant']
 *
 * The value of `this` inside the computed property evaluation function will be
 * the object on which this property resides.
 *
 *   let object = {one: 1, two: 2};
 *   Object.defineProperty('info', new ComputedProperty(function() {
 *     return { type: typeof this, keys: Object.keys(this) };
 *   }));
 *
 *   object.info //=> { type: 'object', keys: ['one', 'two'] }
 *
 * Note that it's totally ok to permanently cache the results of computations
 * since the objects to which these properties will be attached are
 * immutable.
 *
 * @constructor ComputedProperty
 * @param {function} compute - evaluates the property value
 * @param {Object} [attributes] - extra attributes for the descriptor.
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty#Description
 */
export default class ComputedProperty {

  constructor(compute, attributes = {}) {
    let property = this;
    this.get = function() {
      let value = compute.call(this);
      property.get = ()=> value;
      return value;
    };
    assign(this, attributes);
  }
}

ComputedProperty.prototype.writeable = false;

ComputedProperty.prototype.configurable = false;

ComputedProperty.prototype.enumerable = false;
{'fraction_non_alphanumeric': 0.1098546042003231, 'fraction_numerical': 0.0010096930533117932, 'mean_word_length': 3.6203358208955225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '7024917', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1306, 'n_words': 526}