@reactivex/ix-es5-esm
Version:
The Interactive Extensions for JavaScript
29 lines (27 loc) • 909 B
JavaScript
import { __values } from "tslib";
/**
* Converts an existing iterable to anarray of values.
*
* @template TSource The type of elements in the source sequence.
* @param {Iterable<TSource>} source The source sequence to convert to an array.
* @returns {TSource[]} All the items from the source sequence as an array.
*/
export function toArray(source) {
var e_1, _a;
var results = [];
try {
for (var source_1 = __values(source), source_1_1 = source_1.next(); !source_1_1.done; source_1_1 = source_1.next()) {
var item = source_1_1.value;
results.push(item);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (source_1_1 && !source_1_1.done && (_a = source_1.return)) _a.call(source_1);
}
finally { if (e_1) throw e_1.error; }
}
return results;
}
//# sourceMappingURL=toarray.js.map