aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/rxjs/src/internal/util/subscribeToArray.ts
blob: 0ca529428b36c801e10792d9f1ad5564237d2bb1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import { Subscriber } from '../Subscriber';

/**
 * Subscribes to an ArrayLike with a subscriber
 * @param array The array or array-like to subscribe to
 */
export const subscribeToArray = <T>(array: ArrayLike<T>) => (subscriber: Subscriber<T>) => {
  for (let i = 0, len = array.length; i < len && !subscriber.closed; i++) {
    subscriber.next(array[i]);
  }
  subscriber.complete();
};
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage