import { IterableX } from './iterablex' ; import { FromIterable } from './from' ; import { isIterable , isArrayLike } from '../util/isiterable' ; import { identity } from '../util/identity' ; param { string } source returns { IterableX < string > } export function as ( source ) ; template T param { Iterable < T > } source returns { IterableX < T > } export function as < T > ( source ) ; template T param { ArrayLike < T > } source returns { IterableX < T > } export function as < T > ( source ) ; template T param { T } source returns { IterableX < T > } export function as < T > ( source ) ; nocollapse export function as ( source ) { if ( source instanceof IterableX ) { return source ; } if ( typeof source === 'string' ) { return new FromIterable ( [ source ] , identity ) ; } if ( isIterable ( source ) ) { return new FromIterable ( source , identity ) ; } if ( isArrayLike ( source ) ) { return new FromIterable ( source , identity ) ; } return new FromIterable ( [ source ] , identity ) ; }