Comparing version 0.6.0 to 0.6.1
@@ -12,11 +12,3 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function iterateAsync(iterable) { | ||
var _iterator, _step, value; | ||
return _regenerator.default.async(function iterateAsync$(_context) { | ||
@@ -26,19 +18,5 @@ while (1) { | ||
case 0: | ||
_iterator = _createForOfIteratorHelperLoose(iterable); | ||
return _context.delegateYield(iterable, "t0", 1); | ||
case 1: | ||
if ((_step = _iterator()).done) { | ||
_context.next = 7; | ||
break; | ||
} | ||
value = _step.value; | ||
_context.next = 5; | ||
return value; | ||
case 5: | ||
_context.next = 1; | ||
break; | ||
case 7: | ||
case "end": | ||
@@ -45,0 +23,0 @@ return _context.stop(); |
@@ -7,5 +7,3 @@ Object.defineProperty(exports, "__esModule", { | ||
async function* iterateAsync(iterable) { | ||
for await (const value of iterable) { | ||
yield value; | ||
} | ||
yield* iterable; | ||
} |
{ | ||
"name": "iterama", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Composable functional (async) iterable helpers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,1 +0,1 @@ | ||
export declare function iterateAsync<T>(iterable: AsyncIterable<T>): AsyncIterableIterator<T>; | ||
export declare function iterateAsync<T>(iterable: AsyncIterable<T>): AsyncGenerator<T, any, any>; |
@@ -1,1 +0,1 @@ | ||
export declare function iterate<T>(iterable: Iterable<T>): IterableIterator<T>; | ||
export declare function iterate<T>(iterable: Iterable<T>): Generator<T, any, any>; |
@@ -0,4 +1,5 @@ | ||
import _wrapAsyncGenerator from "@babel/runtime/helpers/esm/wrapAsyncGenerator"; | ||
import _awaitAsyncGenerator from "@babel/runtime/helpers/esm/awaitAsyncGenerator"; | ||
import _wrapAsyncGenerator from "@babel/runtime/helpers/esm/wrapAsyncGenerator"; | ||
import _asyncIterator from "@babel/runtime/helpers/esm/asyncIterator"; | ||
import _asyncGeneratorDelegate from "@babel/runtime/helpers/esm/asyncGeneratorDelegate"; | ||
export function iterateAsync(_x) { | ||
@@ -10,26 +11,3 @@ return _iterateAsync.apply(this, arguments); | ||
_iterateAsync = _wrapAsyncGenerator(function* (iterable) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError; | ||
try { | ||
for (var _iterator = _asyncIterator(iterable), _step, _value; _step = yield _awaitAsyncGenerator(_iterator.next()), _iteratorNormalCompletion = _step.done, _value = yield _awaitAsyncGenerator(_step.value), !_iteratorNormalCompletion; _iteratorNormalCompletion = true) { | ||
var value = _value; | ||
yield value; | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
yield _awaitAsyncGenerator(_iterator.return()); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
yield* _asyncGeneratorDelegate(_asyncIterator(iterable), _awaitAsyncGenerator); | ||
}); | ||
@@ -36,0 +14,0 @@ return _iterateAsync.apply(this, arguments); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
323092
4712