UNPKG

659 BJavaScriptView Raw
1import { IterableX } from './iterablex';
2import { FromIterable } from './from';
3import { isIterable, isArrayLike } from '../util/isiterable';
4import { identity } from '../util/identity';
5/** @nocollapse */
6export 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//# sourceMappingURL=as.mjs.map