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.2.0-d6d2bd4 to 0.2.0

76

dist-web/index.js

@@ -7,7 +7,7 @@ /**

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;

@@ -21,3 +21,3 @@ promise.then(value => succeed(value)).catch(error => fail(error)); // this execution has passed out of scope, so we don't care

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

@@ -84,3 +84,3 @@ function isGeneratorFunction(fn) {

return flatMap(this, call => Continuation.of(x => {
let next = fn(call(x));
var next = fn(call(x));

@@ -118,3 +118,3 @@ if (next instanceof Continuation) {

function flatMap(continuation, sequence) {
let next = sequence(continuation.call);
var next = sequence(continuation.call);

@@ -239,4 +239,4 @@ if (!(next instanceof Continuation)) {

cannot(operationName) {
let name = this.constructor.name;
let message = "tried to perfom operation ".concat(operationName, "() on an execution with status '").concat(name, "'");
var name = this.constructor.name;
var message = "tried to perfom operation ".concat(operationName, "() on an execution with status '").concat(name, "'");
throw new Error("InvalidOperationError: ".concat(message));

@@ -246,3 +246,5 @@ }

finalize(status) {
let execution = this.execution;
var {
execution
} = this;
execution.status = status;

@@ -254,3 +256,3 @@ execution.continuation.call(execution);

const Finalized = Status => class FinalizedStatus extends Status {
var Finalized = Status => class FinalizedStatus extends Status {
halt() {}

@@ -262,5 +264,9 @@

start(args) {
let proc = this.execution.proc;
let execution = this.execution;
let iterator = proc.apply(execution, args);
var {
proc
} = this.execution;
var {
execution
} = this;
var iterator = proc.apply(execution, args);
execution.status = new Running(execution, iterator);

@@ -274,3 +280,3 @@ execution.resume();

constructor(execution, iterator) {
let current = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
var current = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
done: false

@@ -288,8 +294,10 @@ };

thunk(thunk) {
let execution = this.execution,
iterator = this.iterator;
var {
execution,
iterator
} = this;
try {
this.releaseControl();
let next = thunk(iterator);
var next = thunk(iterator);

@@ -303,4 +311,4 @@ if (next.done) {

} else {
let control = controllerFor(next.value);
let release = control(execution);
var control = controllerFor(next.value);
var release = control(execution);

@@ -330,4 +338,6 @@ if (typeof release === 'function') {

halt(value) {
let execution = this.execution,
iterator = this.iterator;
var {
execution,
iterator
} = this;
this.releaseControl();

@@ -343,4 +353,4 @@ iterator.return(value);

fork(task, args) {
let parent = this.execution;
let child = new Execution(task).then(() => {
var parent = this.execution;
var child = new Execution(task).then(() => {
if (parent.isWaiting && !parent.hasBlockingChildren) {

@@ -383,3 +393,5 @@ this.finalize(new Completed(parent, parent.result));

halt(value) {
let execution = this.execution;
var {
execution
} = this;
execution.status = new Halted(execution, value);

@@ -393,3 +405,5 @@ execution.children.forEach(child => {

throw(error) {
let execution = this.execution;
var {
execution
} = this;
execution.status = new Errored(execution, error);

@@ -424,3 +438,3 @@ execution.children.forEach(child => {

return parent => {
let child = new Execution(task).then(child => {
var child = new Execution(task).then(child => {
if (child.isCompleted) {

@@ -442,5 +456,5 @@ return parent.resume(child.result);

}
const ExecutionFinalized = Continuation.of(execution => {
var ExecutionFinalized = Continuation.of(execution => {
if (execution.isErrored) {
let error = execution.result;
var error = execution.result;
error.execution = execution;

@@ -454,3 +468,3 @@ throw error;

function execute(task) {
let execution = Execution.of(task);
var execution = Execution.of(task);

@@ -475,5 +489,5 @@ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

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);

@@ -480,0 +494,0 @@ };

{
"name": "effection",
"description": "Effortlessly composable structured concurrency primitive for JavaScript",
"version": "0.2.0-d6d2bd4",
"version": "0.2.0",
"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