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

fn-machine

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fn-machine - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

2

package.json
{
"name": "fn-machine",
"version": "0.0.12",
"version": "0.0.13",
"description": "a tiny functional state machine",

@@ -5,0 +5,0 @@ "main": "index",

@@ -39,3 +39,2 @@ /** @typedef {import('./fn-state').CurrentState} CurrentState */

// throw if next state is undefined
// throw new Error(`the transition '${event}' of current state '${current}', returned a non-existant desired state '${next.state}'.`);
throw `the transition '${event}' of current state '${current}', returned a non-existant desired state '${next.state}'.`;

@@ -54,3 +53,13 @@ }

// enter _can_ change state
newState.enter && newState.enter(next.context || context);
// enter can also optionally return a new context
const newContext = (newState.enter && newState.enter(next.context || context));
// since a common use case for an enter fn is to call an async method (usually loading data),
// ignore the return if it's a promise. This is not foolproof but should
// handle most cases.
if (newContext && !(newContext instanceof Promise)) {
context = next.context = newContext;
// run changeCb again if context has changed
changeCb(next);
}
} else {

@@ -57,0 +66,0 @@ loggerFn(`state '${current}' does not handle event '${event}'.`);

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