node_modules updated, buefy add to lib folder
This commit is contained in:
+37
-39
@@ -1,17 +1,11 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { isPromise } from '../util/isPromise';
|
||||
import { isArrayLike } from '../util/isArrayLike';
|
||||
import { isInteropObservable } from '../util/isInteropObservable';
|
||||
import { isIterable } from '../util/isIterable';
|
||||
import { fromArray } from './fromArray';
|
||||
import { fromPromise } from './fromPromise';
|
||||
import { fromIterable } from './fromIterable';
|
||||
import { fromObservable } from './fromObservable';
|
||||
import { subscribeTo } from '../util/subscribeTo';
|
||||
import { ObservableInput, SchedulerLike } from '../types';
|
||||
import { ObservableInput, SchedulerLike, ObservedValueOf } from '../types';
|
||||
import { scheduled } from '../scheduled/scheduled';
|
||||
|
||||
export function from<T>(input: ObservableInput<T>, scheduler?: SchedulerLike): Observable<T>;
|
||||
export function from<T>(input: ObservableInput<ObservableInput<T>>, scheduler?: SchedulerLike): Observable<Observable<T>>;
|
||||
export function from<O extends ObservableInput<any>>(input: O): Observable<ObservedValueOf<O>>;
|
||||
/** @deprecated use {@link scheduled} instead. */
|
||||
export function from<O extends ObservableInput<any>>(input: O, scheduler: SchedulerLike): Observable<ObservedValueOf<O>>;
|
||||
|
||||
/**
|
||||
* Creates an Observable from an Array, an array-like object, a Promise, an iterable object, or an Observable-like object.
|
||||
@@ -27,9 +21,11 @@ export function from<T>(input: ObservableInput<ObservableInput<T>>, scheduler?:
|
||||
* converted through this operator.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* ### Converts an array to an Observable
|
||||
* ```javascript
|
||||
* import { from } from 'rxjs/observable/from';
|
||||
*
|
||||
* ```ts
|
||||
* import { from } from 'rxjs';
|
||||
*
|
||||
* const array = [10, 20, 30];
|
||||
* const result = from(array);
|
||||
@@ -37,15 +33,18 @@ export function from<T>(input: ObservableInput<ObservableInput<T>>, scheduler?:
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Logs:
|
||||
* // 10 20 30
|
||||
* // 10
|
||||
* // 20
|
||||
* // 30
|
||||
* ```
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* ### Convert an infinite iterable (from a generator) to an Observable
|
||||
* ```javascript
|
||||
*
|
||||
* ```ts
|
||||
* import { from } from 'rxjs';
|
||||
* import { take } from 'rxjs/operators';
|
||||
* import { from } from 'rxjs/observable/from';
|
||||
*
|
||||
* function* generateDoubles(seed) {
|
||||
* let i = seed;
|
||||
@@ -61,32 +60,44 @@ export function from<T>(input: ObservableInput<ObservableInput<T>>, scheduler?:
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Logs:
|
||||
* // 3 6 12 24 48 96 192 384 768 1536
|
||||
* // 3
|
||||
* // 6
|
||||
* // 12
|
||||
* // 24
|
||||
* // 48
|
||||
* // 96
|
||||
* // 192
|
||||
* // 384
|
||||
* // 768
|
||||
* // 1536
|
||||
* ```
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* ### with async scheduler
|
||||
* ```javascript
|
||||
* import { from } from 'rxjs/observable/from';
|
||||
* import { async } from 'rxjs/scheduler/async';
|
||||
* ### With async scheduler
|
||||
*
|
||||
* ```ts
|
||||
* import { from, asyncScheduler } from 'rxjs';
|
||||
*
|
||||
* console.log('start');
|
||||
*
|
||||
* const array = [10, 20, 30];
|
||||
* const result = from(array, async);
|
||||
* const result = from(array, asyncScheduler);
|
||||
*
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* console.log('end');
|
||||
*
|
||||
* // Logs:
|
||||
* // start end 10 20 30
|
||||
* // start
|
||||
* // end
|
||||
* // 10
|
||||
* // 20
|
||||
* // 30
|
||||
* ```
|
||||
*
|
||||
* @see {@link fromEvent}
|
||||
* @see {@link fromEventPattern}
|
||||
* @see {@link fromPromise}
|
||||
*
|
||||
* @param {ObservableInput<T>} A subscription object, a Promise, an Observable-like,
|
||||
* an Array, an iterable, or an array-like object to be converted.
|
||||
@@ -95,26 +106,13 @@ export function from<T>(input: ObservableInput<ObservableInput<T>>, scheduler?:
|
||||
* @name from
|
||||
* @owner Observable
|
||||
*/
|
||||
|
||||
export function from<T>(input: ObservableInput<T>, scheduler?: SchedulerLike): Observable<T> {
|
||||
if (!scheduler) {
|
||||
if (input instanceof Observable) {
|
||||
return input;
|
||||
}
|
||||
return new Observable<T>(subscribeTo(input));
|
||||
} else {
|
||||
return scheduled(input, scheduler);
|
||||
}
|
||||
|
||||
if (input != null) {
|
||||
if (isInteropObservable(input)) {
|
||||
return fromObservable(input, scheduler);
|
||||
} else if (isPromise(input)) {
|
||||
return fromPromise(input, scheduler);
|
||||
} else if (isArrayLike(input)) {
|
||||
return fromArray(input, scheduler);
|
||||
} else if (isIterable(input) || typeof input === 'string') {
|
||||
return fromIterable(input, scheduler);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TypeError((input !== null && typeof input || input) + ' is not observable');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user