UNPKG

506 BJavaScriptView Raw
1/**
2 * Converts the existing iterable into a promise which resolves a Set.
3 *
4 * @export
5 * @template TSource The type of elements in the source sequence.
6 * @param {Iterable<TSource>} source The iterable to convert into a set.
7 * @returns {Set<TSource>} A promise which contains a Set with all the elements from the iterable.
8 */
9export function toSet(source) {
10 const set = new Set();
11 for (const item of source) {
12 set.add(item);
13 }
14 return set;
15}
16
17//# sourceMappingURL=toset.mjs.map