1 | import { IterableX } from './iterablex';
|
2 | import { FromIterable } from './from';
|
3 | import { isIterable, isArrayLike } from '../util/isiterable';
|
4 | import { identity } from '../util/identity';
|
5 |
|
6 | export function as(source) {
|
7 | if (source instanceof IterableX) {
|
8 | return source;
|
9 | }
|
10 | if (typeof source === 'string') {
|
11 | return new FromIterable([source], identity);
|
12 | }
|
13 | if (isIterable(source)) {
|
14 | return new FromIterable(source, identity);
|
15 | }
|
16 | if (isArrayLike(source)) {
|
17 | return new FromIterable(source, identity);
|
18 | }
|
19 | return new FromIterable([source], identity);
|
20 | }
|
21 |
|
22 |
|