UNPKG

@idealic/poker-engine

Version:

Professional poker game engine and hand evaluator with built-in iterator utilities

29 lines 658 B
/** * Functions for taking a limited number of elements from an iterable */ /** * Internal implementation of async take * * @param input Source iterable to take from * @param count Number of elements to take */ async function* _take(input, count) { if (count <= 0) return; let taken = 0; for await (const value of input) { yield value; taken++; if (taken >= count) break; } } export function take(input, count) { if (typeof input === 'number') { return (_input) => take(_input, input); } else { return _take(input, count); } } //# sourceMappingURL=take.js.map