Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@async-generators/iterable

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@async-generators/iterable - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

2

dist/commonjs/index.d.ts

@@ -1,1 +0,1 @@

export default function <T>(source: AsyncIterable<T> | Iterable<T>, errmsg?: string): AsyncIterable<T>;
export default function iterable<T>(source: AsyncIterable<T> | Iterable<T> | (() => AsyncIterable<T> | Iterable<T>), errmsg?: string): AsyncIterable<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function default_1(source, errmsg = "source parameter is not iterable") {
function iterable(source, errmsg = "source parameter is not iterable") {
if (source == undefined) {
throw Error(errmsg);
}
const It = source[Symbol.asyncIterator] || source[Symbol.iterator];
if (typeof It !== "function")
if (typeof It !== "function") {
if (typeof source === "function") {
return iterable(source(), errmsg);
}
throw Error(errmsg);
}
return {

@@ -11,3 +18,3 @@ [Symbol.asyncIterator]() { return It.call(source); }

}
exports.default = default_1;
exports.default = iterable;
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

export default function <T>(source: AsyncIterable<T> | Iterable<T>, errmsg?: string): AsyncIterable<T>;
export default function iterable<T>(source: AsyncIterable<T> | Iterable<T> | (() => AsyncIterable<T> | Iterable<T>), errmsg?: string): AsyncIterable<T>;

@@ -1,5 +0,12 @@

export default function (source, errmsg = "source parameter is not iterable") {
export default function iterable(source, errmsg = "source parameter is not iterable") {
if (source == undefined) {
throw Error(errmsg);
}
const It = source[Symbol.asyncIterator] || source[Symbol.iterator];
if (typeof It !== "function")
if (typeof It !== "function") {
if (typeof source === "function") {
return iterable(source(), errmsg);
}
throw Error(errmsg);
}
return {

@@ -6,0 +13,0 @@ [Symbol.asyncIterator]() { return It.call(source); }

{
"name": "@async-generators/iterable",
"description": "wrap async/sync Iterable as an asyncIterable",
"version": "0.2.0",
"version": "0.3.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Meirion Hughes",

@@ -1,8 +0,18 @@

export default function <T>(
source: AsyncIterable<T> | Iterable<T>,
errmsg:string = "source parameter is not iterable"
export default function iterable<T>(
source: AsyncIterable<T> | Iterable<T> | (() => AsyncIterable<T> | Iterable<T>),
errmsg: string = "source parameter is not iterable"
): AsyncIterable<T> {
if (source == undefined) {
throw Error(errmsg);
}
const It = source[Symbol.asyncIterator] || source[Symbol.iterator];
if (typeof It !== "function")
if (typeof It !== "function") {
if (typeof source === "function") {
return iterable(source(), errmsg);
}
throw Error(errmsg);
}
return {

@@ -9,0 +19,0 @@ [Symbol.asyncIterator]() { return It.call(source); }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc