<commit_before>import { extend, noop } from '../core/utils';

/**
 * Class for declaring computed function dependencies.
 * Given array shuold contain models, binded to some
 * logec. They will be passed to compute function. Also
 * they will be used to track changed and re-run compute
 * @param {Array<Object>} deps
 */
function DependsDef(deps) {
  this.computeFn = noop;
  this.deps = deps;
}

extend(DependsDef.prototype, {
  /**
   * Set computed funtion to be used for computing the field
   * on every self model update or on every dependencies model
   * updated. It will get given in construction dependencies
   * models as arguments.
   * @param  {function} func
   * @return {DependsDef}
   */
  compute(func) {
    this.computeFn = func;
    return this;
  }
});

export default DependsDef;<commit_msg>fix(core): clone depends on each call to compute<commit_after>import { extend, noop } from '../core/utils';

/**
 * Class for declaring computed function dependencies.
 * Given array shuold contain models, binded to some
 * logec. They will be passed to compute function. Also
 * they will be used to track changed and re-run compute
 * @param {Array<Object>} deps
 */
function DependsDef(deps) {
  this.computeFn = noop;
  this.deps = deps;
}

extend(DependsDef.prototype, {
  /**
   * Set computed funtion to be used for computing the field
   * on every self model update or on every dependencies model
   * updated. It will get given in construction dependencies
   * models as arguments.
   * @param  {function} func
   * @return {DependsDef}
   */
  compute(func) {
    const nextDepends = new DependsDef(this.deps);
    nextDepends.computeFn = func;
    return nextDepends;
  }
});

export default DependsDef;
{'fraction_non_alphanumeric': 0.09468822170900693, 'fraction_numerical': 0.0, 'mean_word_length': 3.489637305699482, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4933562', 'n_tokens_mistral': 512, 'n_tokens_neox': 506, 'n_words': 194}