src/core/eq.js
/**
* Eq.
*
* @param {number} n
* @param {Iterable} iterable
*/
const eq = (n, iterable) => {
if (n < 0 || !Number.isInteger(n)) return false;
if (iterable.length !== undefined) return iterable.length === n;
if (iterable.size !== undefined) return iterable.size === n;
const it = iterable[Symbol.iterator]();
for (; n > 0; --n) if (it.next().done) return false;
return it.next().done;
};
export default eq;