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

@travetto/worker

Package Overview
Dependencies
Maintainers
1
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/worker - npm Package Compare versions

Comparing version 0.6.6 to 0.6.7

8

package.json

@@ -11,4 +11,4 @@ {

"dependencies": {
"@travetto/base": "^0.6.7",
"@travetto/exec": "^0.6.6",
"@travetto/base": "^0.6.8",
"@travetto/exec": "^0.6.7",
"@types/generic-pool": "^3.1.9",

@@ -36,4 +36,4 @@ "generic-pool": "^3.7.1"

},
"version": "0.6.6",
"gitHead": "c35fd3147d5c95e72f0a22d67124ff4d48da0878"
"version": "0.6.7",
"gitHead": "db85544d26a8e9f9932ccc314b88f113fafbdee5"
}
import { InputSource } from './types';
function isIterator<T>(o: any): o is Iterator<T> {
type Itr<T> = Iterator<T> | AsyncIterator<T>;
function isIterator<T>(o: any): o is Itr<T> {
return 'next' in o;

@@ -9,7 +11,7 @@ }

private src: Iterator<X>;
private src: Itr<X>;
private ondeck: X;
done = false;
constructor(src: (() => Iterator<X>) | Iterator<X>) {
constructor(src: (() => Itr<X>) | Itr<X>) {
if (isIterator(src)) {

@@ -22,4 +24,4 @@ this.src = src;

private primeNext() {
const res = this.src.next();
private async primeNext() {
const res = await this.src.next();
this.done = res.done;

@@ -29,5 +31,5 @@ this.ondeck = res.value;

hasNext() {
async hasNext() {
if (this.ondeck === undefined) {
this.primeNext();
await this.primeNext();
}

@@ -37,4 +39,4 @@ return !this.done;

next() {
this.hasNext();
async next() {
await this.hasNext();

@@ -41,0 +43,0 @@ const out = this.ondeck;

export interface InputSource<X> {
hasNext(): boolean;
hasNext(): boolean | Promise<boolean>;
next(): X | Promise<X>;
}

@@ -92,3 +92,3 @@ import * as os from 'os';

while (src.hasNext()) {
while (await src.hasNext()) {
const worker = (await this.pool.acquire())!;

@@ -95,0 +95,0 @@ const nextInput = await src.next();

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