UNPKG

485 BJavaScriptView Raw
1/**
2 * Converts an existing iterable to anarray of values.
3 *
4 * @export
5 * @template TSource The type of elements in the source sequence.
6 * @param {Iterable<TSource>} source The source sequence to convert to an array.
7 * @returns {TSource[]} All the items from the source sequence as an array.
8 */
9export function toArray(source) {
10 const results = [];
11 for (const item of source) {
12 results.push(item);
13 }
14 return results;
15}
16
17//# sourceMappingURL=toarray.mjs.map