Comparing version 0.5.0 to 0.6.0
@@ -20,7 +20,3 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var concatAsync = function concatAsync() { | ||
for (var _len = arguments.length, iterables = new Array(_len), _key = 0; _key < _len; _key++) { | ||
iterables[_key] = arguments[_key]; | ||
} | ||
var concatAsync = function concatAsync(iterables) { | ||
return (0, _defineProperty2.default)({}, Symbol.asyncIterator, _regenerator.default.mark(function _callee() { | ||
@@ -27,0 +23,0 @@ var _iterator, _step, it; |
@@ -20,7 +20,3 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var concat = function concat() { | ||
for (var _len = arguments.length, iterables = new Array(_len), _key = 0; _key < _len; _key++) { | ||
iterables[_key] = arguments[_key]; | ||
} | ||
var concat = function concat(iterables) { | ||
return (0, _defineProperty2.default)({}, Symbol.iterator, _regenerator.default.mark(function _callee() { | ||
@@ -27,0 +23,0 @@ var _iterator, _step, it; |
@@ -293,2 +293,26 @@ Object.defineProperty(exports, "__esModule", { | ||
var _startWithAsync = require("./start-with-async"); | ||
Object.keys(_startWithAsync).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _startWithAsync[key]; | ||
} | ||
}); | ||
}); | ||
var _startWith = require("./start-with"); | ||
Object.keys(_startWith).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _startWith[key]; | ||
} | ||
}); | ||
}); | ||
var _takeAsync = require("./take-async"); | ||
@@ -295,0 +319,0 @@ |
@@ -0,1 +1,3 @@ | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -6,7 +8,26 @@ value: true | ||
var _concat = require("./concat"); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var startWith = function startWith(value) { | ||
return function (iterable) { | ||
return (0, _concat.concat)([value], iterable); | ||
return (0, _defineProperty2.default)({}, Symbol.iterator, _regenerator.default.mark(function _callee() { | ||
return _regenerator.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return value; | ||
case 2: | ||
return _context.delegateYield(iterable, "t0", 3); | ||
case 3: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
}; | ||
@@ -13,0 +34,0 @@ }; |
@@ -8,3 +8,3 @@ Object.defineProperty(exports, "__esModule", { | ||
const concatAsync = (...iterables) => ({ | ||
const concatAsync = iterables => ({ | ||
async *[Symbol.asyncIterator]() { | ||
@@ -11,0 +11,0 @@ for await (const it of iterables) { |
@@ -8,3 +8,3 @@ Object.defineProperty(exports, "__esModule", { | ||
const concat = (...iterables) => ({ | ||
const concat = iterables => ({ | ||
*[Symbol.iterator]() { | ||
@@ -11,0 +11,0 @@ for (const it of iterables) { |
@@ -293,2 +293,26 @@ Object.defineProperty(exports, "__esModule", { | ||
var _startWithAsync = require("./start-with-async"); | ||
Object.keys(_startWithAsync).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _startWithAsync[key]; | ||
} | ||
}); | ||
}); | ||
var _startWith = require("./start-with"); | ||
Object.keys(_startWith).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _startWith[key]; | ||
} | ||
}); | ||
}); | ||
var _takeAsync = require("./take-async"); | ||
@@ -295,0 +319,0 @@ |
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", { | ||
var _concat = require("./concat"); | ||
const startWith = value => iterable => ({ | ||
*[Symbol.iterator]() { | ||
yield value; | ||
yield* iterable; | ||
} | ||
const startWith = value => iterable => (0, _concat.concat)([value], iterable); | ||
}); | ||
exports.startWith = startWith; |
{ | ||
"name": "iterama", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Composable functional (async) iterable helpers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -92,3 +92,3 @@ # iterama ![npm](https://flat.badgen.net/npm/v/iterama) | ||
```ts | ||
const concat: <T>(...iterables: Iterable<T>[]) => Iterable<T> | ||
const concat: <T>(iterables: Iterable<Iterable<T>>) => Iterable<T> | ||
``` | ||
@@ -101,3 +101,3 @@ | ||
const iterable2 = [4, 5, 6] | ||
const result = concat(iterable1, iterable2) | ||
const result = concat([iterable1, iterable2]) | ||
@@ -120,3 +120,3 @@ for (const value of result) | ||
```ts | ||
const concatAsync: <T>(...iterables: AsyncIterable<T>[]) => AsyncIterable<T> | ||
const concatAsync: <T>(iterables: Iterable<AsyncIterable<T>>) => AsyncIterable<T> | ||
``` | ||
@@ -141,3 +141,3 @@ | ||
} | ||
const result = concatAsync(iterable1, iterable2) | ||
const result = concatAsync([iterable1, iterable2]) | ||
@@ -144,0 +144,0 @@ for await (const value of result) |
@@ -1,1 +0,1 @@ | ||
export declare const concatAsync: <T>(...iterables: AsyncIterable<T>[]) => AsyncIterable<T>; | ||
export declare const concatAsync: <T>(iterables: Iterable<AsyncIterable<T>>) => AsyncIterable<T>; |
@@ -1,1 +0,1 @@ | ||
export declare const concat: <T>(...iterables: Iterable<T>[]) => Iterable<T>; | ||
export declare const concat: <T>(iterables: Iterable<Iterable<T>>) => Iterable<T>; |
@@ -25,2 +25,4 @@ export * from './concat-async'; | ||
export * from './slice'; | ||
export * from './start-with-async'; | ||
export * from './start-with'; | ||
export * from './take-async'; | ||
@@ -27,0 +29,0 @@ export * from './take'; |
@@ -7,7 +7,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import { iterateAsync } from './iterate-async'; | ||
export var concatAsync = function concatAsync() { | ||
for (var _len = arguments.length, iterables = new Array(_len), _key = 0; _key < _len; _key++) { | ||
iterables[_key] = arguments[_key]; | ||
} | ||
export var concatAsync = function concatAsync(iterables) { | ||
return _defineProperty({}, Symbol.asyncIterator, function () { | ||
@@ -14,0 +10,0 @@ return _wrapAsyncGenerator(function* () { |
@@ -10,7 +10,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import { iterate } from './iterate'; | ||
export var concat = function concat() { | ||
for (var _len = arguments.length, iterables = new Array(_len), _key = 0; _key < _len; _key++) { | ||
iterables[_key] = arguments[_key]; | ||
} | ||
export var concat = function concat(iterables) { | ||
return _defineProperty({}, Symbol.iterator, function* () { | ||
@@ -17,0 +13,0 @@ var _iterator = _createForOfIteratorHelper(iterables), |
@@ -25,2 +25,4 @@ export * from './concat-async'; | ||
export * from './slice'; | ||
export * from './start-with-async'; | ||
export * from './start-with'; | ||
export * from './take-async'; | ||
@@ -27,0 +29,0 @@ export * from './take'; |
@@ -1,7 +0,10 @@ | ||
import { concat } from './concat'; | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
export var startWith = function startWith(value) { | ||
return function (iterable) { | ||
return concat([value], iterable); | ||
return _defineProperty({}, Symbol.iterator, function* () { | ||
yield value; | ||
yield* iterable; | ||
}); | ||
}; | ||
}; | ||
//# sourceMappingURL=start-with.js.map |
@@ -17,6 +17,8 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var _step$value = _slicedToArray(_step.value, 2), | ||
key = _step$value[0], | ||
value = _step$value[1]; | ||
var _ref3 = _step.value; | ||
var _ref2 = _slicedToArray(_ref3, 2); | ||
var key = _ref2[0]; | ||
var value = _ref2[1]; | ||
result.set(key, value); | ||
@@ -23,0 +25,0 @@ } |
@@ -17,6 +17,8 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var _step$value = _slicedToArray(_step.value, 2), | ||
key = _step$value[0], | ||
value = _step$value[1]; | ||
var _ref3 = _step.value; | ||
var _ref2 = _slicedToArray(_ref3, 2); | ||
var key = _ref2[0]; | ||
var value = _ref2[1]; | ||
result[key] = value; | ||
@@ -23,0 +25,0 @@ } |
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
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
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
325601
273
4752