Problem
es-toolkit currently provides head, but it appears to be array-oriented. For example, it works for arrays but not generic iterables such as Set:
head([1, 2]); // 1
head(new Set([1, 2])); // undefined
It would be good if there is a new function that works across all iterables. It would be a shortcut of values[Symbol.iterator]().next().value;.
Problem
es-toolkitcurrently provideshead, but it appears to be array-oriented. For example, it works for arrays but not generic iterables such asSet:It would be good if there is a new function that works across all iterables. It would be a shortcut of
values[Symbol.iterator]().next().value;.