@softchef/cdk-iot-device-management
Version:
IoT device management is composed of things, thing types, thing groups, jobs, files API services. The constructs can be used independently, that are based on full-managed service to create an API Gateway & Lambda function.
33 lines (26 loc) • 559 B
JavaScript
/* eslint no-constant-condition: 0 */
/**
* Obliterator Consume Function
* =============================
*
* Function consuming the given iterator for n or every steps.
*/
/**
* Consume.
*
* @param {Iterator} iterator - Target iterator.
* @param {number} [steps] - Optional steps.
*/
module.exports = function consume(iterator, steps) {
var step,
l = arguments.length > 1 ? steps : Infinity,
i = 0;
while (true) {
if (i === l)
return;
step = iterator.next();
if (step.done)
return;
i++;
}
};