<commit_before>import _       from 'lodash';
import errorer from '../../../errorer/errorer';

export default class {
  constructor(instance, receiver, receiverConfigs, params) {
    let {events = {}} = instance;
    let method = events[receiver] || receiver;
    _.extend(this, {data: {}, instance, method, receiverConfigs, params});
    return this.handler.bind(this);
  }

  handler(result, storeAs) {
    let {data, receiverConfigs, params, instance, method} = this;
    let {complete, reset} = receiverConfigs;
    let previous = Promise.resolve(data[storeAs]);
    let current = Promise.resolve(result);
    
    previous.then(() => current).then(result => {
      data[storeAs] = result;
      
      if(complete) {
        if(_.keys(data).length < params.length) {
          return;
        }
        
        if(reset) {
          setTimeout(() => this.data = {});<commit_msg>Adjust receiver class in connector module<commit_after>import _       from 'lodash';
import errorer from '../../../errorer/errorer';

export default class {
  constructor(instance, receiver, receiverConfigs, params) {
    let {events = {}} = instance;
    let method = events[receiver] || receiver;
    _.extend(this, {data: {}, instance, method, receiverConfigs, params});
    return this.handler.bind(this);
  }

  handler(result, storeAs) {
    let {data, receiverConfigs, params, instance, method} = this;
    let {complete, reset} = receiverConfigs;
    let previous = Promise.resolve(data[storeAs]);
    let current = Promise.resolve(result);
    
    data[storeAs] = previous.then(() => current).then(result => {
      data[storeAs] = result;
      
      if(complete) {
        if(_.keys(data).length < params.length) {
          return;
        }
        
        if(reset) {
          setTimeout(() => this.data = {});
{'fraction_non_alphanumeric': 0.14735099337748345, 'fraction_numerical': 0.0, 'mean_word_length': 2.8248945147679323, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3217676', 'n_tokens_mistral': 525, 'n_tokens_neox': 529, 'n_words': 124}