<commit_before>/**
 * Created by tushar.mathur on 28/09/16.
 */

import {IObservable} from '../types/IObservable';
import {ISubscription} from '../types/ISubscription';
import {IObserver} from '../types/IObserver';

const unsubscribe = function () {
}
const subscription = {unsubscribe, closed: true};

export class FromObservable<T> implements IObservable<T> {
  constructor (private array: Array<T>) {
  }

  subscribe (observer: IObserver<T>): ISubscription {
    for (var i = 0; i < this.array.length; ++i) {
      observer.next(this.array[i])
    }
    observer.complete()
    return subscription
  }
}

export class From2Observable<T> implements IObservable<T> {
  constructor (private array: Array<T>) {
  }

  subscribe (observer: IObserver<T>): ISubscription {
    for (var i = 0; i < this.array.length; ++i) {
      observer.next(this.array[i])
    }
    observer.complete()
    return subscription
  }
}

export function from<T> (list: Array<T>): IObservable<T> {
  return new FromObservable(list)
}

export function from2<T> (list: Array<T>): IObservable<T> {
  return new From2Observable(list)
}<commit_msg>remove from2<commit_after>/**
 * Created by tushar.mathur on 28/09/16.
 */

import {IObservable} from '../types/IObservable';
import {ISubscription} from '../types/ISubscription';
import {IObserver} from '../types/IObserver';

const unsubscribe = function () {
}
const subscription = {unsubscribe, closed: true};

export class FromObservable<T> implements IObservable<T> {
  constructor (private array: Array<T>) {
  }

  subscribe (observer: IObserver<T>): ISubscription {
    for (var i = 0; i < this.array.length; ++i) {
      observer.next(this.array[i])
    }
    observer.complete()
    return subscription
  }
}

export function from<T> (list: Array<T>): IObservable<T> {
  return new FromObservable(list)
}
{'fraction_non_alphanumeric': 0.14721919302071973, 'fraction_numerical': 0.010359869138495093, 'mean_word_length': 4.027397260273973, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 24, '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': '2806204', 'n_tokens_mistral': 621, 'n_tokens_neox': 603, 'n_words': 152}