Socket
Socket
Sign inDemoInstall

effection

Package Overview
Dependencies
Maintainers
1
Versions
299
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

effection - npm Package Compare versions

Comparing version 0.4.0-e68d744 to 0.4.0-ef2d280

5

dist-node/index.js

@@ -33,4 +33,6 @@ 'use strict';

let noop = x => x;
let noop = x => x; // return values of succeed and fail are deliberately ignored.
// see https://github.com/thefrontside/effection.js/pull/44
promise.then(value => {

@@ -388,3 +390,2 @@ succeed(value);

exports.fork = fork;
exports.promiseOf = promiseOf;
exports.timeout = timeout;

3

dist-src/index.js
export { timeout } from "./timeout.js";
export { fork } from "./fork.js";
export { promiseOf } from "./promise-of.js";
export { fork } from "./fork.js";

@@ -11,4 +11,6 @@ /**

let noop = x => x;
let noop = x => x; // return values of succeed and fail are deliberately ignored.
// see https://github.com/thefrontside/effection.js/pull/44
promise.then(value => {

@@ -15,0 +17,0 @@ succeed(value);

@@ -11,5 +11,5 @@ /**

function timeout() {
let durationMillis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var durationMillis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
return function (execution) {
let timeoutId = setTimeout(() => execution.resume(), durationMillis);
var timeoutId = setTimeout(() => execution.resume(), durationMillis);
return () => clearTimeout(timeoutId);

@@ -19,3 +19,3 @@ };

const noop = x => x;
var noop = x => x;

@@ -28,8 +28,10 @@ /**

return function control(execution) {
let succeed = value => execution.resume(value);
var succeed = value => execution.resume(value);
let fail = err => execution.throw(err);
var fail = err => execution.throw(err);
let noop = x => x;
var noop = x => x; // return values of succeed and fail are deliberately ignored.
// see https://github.com/thefrontside/effection.js/pull/44
promise.then(value => {

@@ -47,3 +49,3 @@ succeed(value);

const GeneratorFunction = function* () {}.constructor;
var GeneratorFunction = function* () {}.constructor;

@@ -129,3 +131,3 @@ function isGeneratorFunction(fn) {

get hasBlockingChildren() {
for (let child of this.children) {
for (var child of this.children) {
if (child.isBlocking) {

@@ -206,4 +208,4 @@ return true;

fork(operation) {
let sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
let child = new Fork(operation, this, sync);
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var child = new Fork(operation, this, sync);
this.children.add(child);

@@ -247,4 +249,4 @@ child.resume();

thunk(fn) {
let next;
let previouslyExecuting = Fork.currentlyExecuting;
var next;
var previouslyExecuting = Fork.currentlyExecuting;

@@ -269,5 +271,5 @@ try {

} else {
let controller = controllerFor(next.value); /// what happens here if control is synchronous. and resumes execution immediately?
var controller = controllerFor(next.value); /// what happens here if control is synchronous. and resumes execution immediately?
let exit = controller(this);
var exit = controller(this);
this.exitPrevious = typeof exit === 'function' ? exit : noop;

@@ -318,3 +320,3 @@ }

function fork(operation) {
let parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Fork.currentlyExecuting;
var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Fork.currentlyExecuting;

@@ -350,2 +352,2 @@ if (parent) {

export { fork, promiseOf, timeout };
export { fork, timeout };
declare module "effection" {
export type Operation = SequenceFn | Sequence | Promise<any> | Controller | undefined;
export type Operation = SequenceFn | Sequence | Promise<any> | Controller | Execution<any> | undefined;
export type SequenceFn = (this: Execution) => Sequence;

@@ -8,3 +8,3 @@ export type Controller = (execution: Execution) => void | (() => void);

export interface Execution<T = any> {
export interface Execution<T = any> extends PromiseLike<any> {
id: number;

@@ -14,2 +14,4 @@ resume(result: T): void;

halt(reason?: any): void;
catch<R>(fn: (Error) => R): Promise<R>;
finally(fn: () => void): Promise<any>;
}

@@ -16,0 +18,0 @@

{
"name": "effection",
"description": "Effortlessly composable structured concurrency primitive for JavaScript",
"version": "0.4.0-e68d744",
"version": "0.4.0-ef2d280",
"license": "MIT",

@@ -6,0 +6,0 @@ "files": [

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