blob: e7ffd2b2aae9846c24f97b476ac365b507a71002 [file] [log] [blame]
import { Observable } from '../Observable';
import { SchedulerLike } from '../types';
import { subscribeToIterable } from '../util/subscribeToIterable';
import { scheduleIterable } from '../scheduled/scheduleIterable';
export function fromIterable<T>(input: Iterable<T>, scheduler?: SchedulerLike) {
if (!input) {
throw new Error('Iterable cannot be null');
}
if (!scheduler) {
return new Observable<T>(subscribeToIterable(input));
} else {
return scheduleIterable(input, scheduler);
}
}