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

conclure

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

conclure - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

13

conclude.js

@@ -95,3 +95,2 @@ import { TYPE } from './effects';

const subscribers = new Set();
let cancel;

@@ -121,3 +120,3 @@ const onConclude = (error, result) => {

cancel = runners.get(flowType)(it, onConclude);
const cancel = runners.get(flowType)(it, onConclude);

@@ -164,8 +163,12 @@ return unsubscribe;

function runIterator(it, callback) {
let cancel;
let cancel, step = 0;
const setCancel = (j, fn) => {
if (j >= step) cancel = fn;
}
function iterate(error, result) {
try {
let cancelled = false;
cancel = () => cancelled = true;
setCancel(++step, () => cancelled = true);

@@ -178,3 +181,3 @@ const { value, done } = error

cancel = conclude(value, done ? callback : iterate);
setCancel(step, conclude(value, done ? callback : iterate));
}

@@ -181,0 +184,0 @@ catch (err) {

{
"name": "conclure",
"version": "1.1.2",
"version": "1.1.3",
"description": "Generator runner",

@@ -5,0 +5,0 @@ "main": "conclude.js",

import test from 'ava';
import { conclude, inProgress, getResult } from '../conclude';
import { conclude, inProgress, getResult, whenFinished } from '../conclude';
import { delay, call } from '../effects';

@@ -89,1 +89,22 @@ import * as Conclude from '../combinators';

});
test.cb('all, cancelling before completion', t => {
const promises = [
Promise.resolve(42),
Promise.reject('boom')
];
function* g() {
yield 5;
yield Conclude.all(promises);
}
const cancel = conclude(g(), t.fail);
let count = 2;
whenFinished(promises[0], ({ cancelled }) => cancelled && --count === 0 && t.end(null));
whenFinished(promises[1], ({ cancelled }) => cancelled && --count === 0 && t.end(null));
cancel();
});
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