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

robot3

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

robot3 - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

17

dist/machine.js

@@ -88,8 +88,13 @@ 'use strict';

let invokePromiseType = {
enter(machine, service, event) {
this.fn.call(service, service.context, event)
.then(data => service.send({ type: 'done', data }))
let invokeFnType = {
enter(machine2, service, event) {
let rn = this.fn.call(service, service.context, event);
if(machine.isPrototypeOf(rn))
return create(invokeMachineType, {
machine: valueEnumerable(rn),
transitions: valueEnumerable(this.transitions)
}).enter(machine2, service, event)
rn.then(data => service.send({ type: 'done', data }))
.catch(error => service.send({ type: 'error', error }));
return machine;
return machine2;
}

@@ -121,3 +126,3 @@ };

}) :
create(invokePromiseType, {
create(invokeFnType, {
fn: valueEnumerable(fn),

@@ -124,0 +129,0 @@ transitions: t

@@ -117,3 +117,3 @@ declare module 'robot3' {

/**
* The `invoke` is a special type of state that immediately invokes a Promise-returning function or another machine.
* The `invoke` is a special type of state that immediately invokes a Promise-returning or Machine-returning function, or another machine.
*

@@ -124,5 +124,13 @@ * @param fn - Promise-returning function

export function invoke<C, T, E extends {} = any>(fn: (ctx: C, e?: E) => Promise<T>, ...args: (Transition | Immediate)[]): MachineState
/**
* The `invoke` is a special type of state that immediately invokes a Promise-returning or Machine-returning function, or another machine.
*
* @param fn - Machine-returning function
* @param args - Any argument needs to be of type Transition or Immediate.
*/
export function invoke<C, E extends {} = any, M extends Machine>(fn: (ctx: C, e?: E) => M, ...args: (Transition | Immediate)[]): MachineState
/**
* The `invoke` is a special type of state that immediately invokes a Promise-returning function or another machine.
* The `invoke` is a special type of state that immediately invokes a Promise-returning or Machine-returning function, or another machine.
*

@@ -129,0 +137,0 @@ * @param machine - Machine

@@ -84,8 +84,13 @@ function valueEnumerable(value) {

let invokePromiseType = {
enter(machine, service, event) {
this.fn.call(service, service.context, event)
.then(data => service.send({ type: 'done', data }))
let invokeFnType = {
enter(machine2, service, event) {
let rn = this.fn.call(service, service.context, event)
if(machine.isPrototypeOf(rn))
return create(invokeMachineType, {
machine: valueEnumerable(rn),
transitions: valueEnumerable(this.transitions)
}).enter(machine2, service, event)
rn.then(data => service.send({ type: 'done', data }))
.catch(error => service.send({ type: 'error', error }));
return machine;
return machine2;
}

@@ -117,3 +122,3 @@ };

}) :
create(invokePromiseType, {
create(invokeFnType, {
fn: valueEnumerable(fn),

@@ -120,0 +125,0 @@ transitions: t

{
"name": "robot3",
"version": "0.3.1",
"version": "0.3.2",
"description": "A function, immutable Finite State Machine library",

@@ -36,7 +36,7 @@ "main": "dist/machine.js",

"devDependencies": {
"@11ty/eleventy": "^0.11.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^3.0.6",
"@11ty/eleventy": "^1.0.2",
"@11ty/eleventy-plugin-syntaxhighlight": "^4.2.0",
"bundlesize": "^0.18.1",
"local-web-server": "^4.2.1",
"markdown-it": "^9.1.0",
"markdown-it": "^13.0.1",
"markdown-it-toc-and-anchor": "^4.2.0",

@@ -43,0 +43,0 @@ "node-qunit-puppeteer": "^1.0.13",

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