🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

robot3

Package Overview
Dependencies
Maintainers
1
Versions
31
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

to
0.2.4

5

debug.js

@@ -7,3 +7,6 @@ import { d } from './machine.js';

d._create = function(states) {
d._create = function(current, states) {
if(!(current in states)) {
throw new Error(`Initial state [${current}] is not a known state.`);
}
for(let p in states) {

@@ -10,0 +13,0 @@ let state = states[p];

@@ -9,3 +9,6 @@ 'use strict';

machine.d._create = function(states) {
machine.d._create = function(current, states) {
if(!(current in states)) {
throw new Error(`Initial state [${current}] is not a known state.`);
}
for(let p in states) {

@@ -12,0 +15,0 @@ let state = states[p];

11

dist/machine.js

@@ -135,5 +135,10 @@ 'use strict';

};
function createMachine(states, contextFn = empty) {
if(d._create) d._create(states);
let current = Object.keys(states)[0];
function createMachine(current, states, contextFn = empty) {
if(typeof current !== 'string') {
contextFn = states || empty;
states = current;
current = Object.keys(states)[0];
}
if(d._create) d._create(current, states);
return create(machine, {

@@ -140,0 +145,0 @@ context: valueEnumerable(contextFn),

@@ -131,5 +131,10 @@ function valueEnumerable(value) {

};
export function createMachine(states, contextFn = empty) {
if(d._create) d._create(states);
let current = Object.keys(states)[0];
export function createMachine(current, states, contextFn = empty) {
if(typeof current !== 'string') {
contextFn = states || empty;
states = current;
current = Object.keys(states)[0];
}
if(d._create) d._create(current, states);
return create(machine, {

@@ -136,0 +141,0 @@ context: valueEnumerable(contextFn),

{
"name": "robot3",
"version": "0.2.3",
"version": "0.2.4",
"description": "A function, immutable Finite State Machine library",

@@ -5,0 +5,0 @@ "main": "dist/machine.js",