Socket
Socket
Sign inDemoInstall

jssm

Package Overview
Dependencies
Maintainers
1
Versions
319
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jssm - npm Package Compare versions

Comparing version 0.16.1 to 0.17.0

2

package.json
{
"name": "jssm",
"version": "0.16.1",
"version": "0.17.0",
"description": "A Javascript state machine with a simple API. Well tested, and typed with Flowtype. MIT License.",

@@ -5,0 +5,0 @@ "main": "dist/jssm.es5.browserified.js",

@@ -119,5 +119,5 @@

{ action:'power_off', from:'red', to:'off', probability: 0.01 },
{ action:'power_off', from:'yellow', to:'off', probability: 0.01 },
{ action:'power_off', from:'green', to:'off', probability: 0.01 },
{ action:'power_off', from:'red', to:'off' },
{ action:'power_off', from:'yellow', to:'off' },
{ action:'power_off', from:'green', to:'off' },

@@ -124,0 +124,0 @@ { name:'switch_warn', from:'green', to:'yellow' },

@@ -316,3 +316,13 @@

action(name : mNT, newData? : mDT) : boolean {
return false; // major todo whargarbl
// todo whargarbl implement hooks
// todo whargarbl implement data stuff
// todo major incomplete whargarbl comeback
if (this.valid_action(name, newData)) {
const edge = this.current_action_edge_for(name);
if (edge) { this._state = edge.to; }
else { throw new Error(`Should be impossible - valid_action true, no edge in current_action_edge_for, in action(${JSON.stringify(name)}...)`); }
return true;
} else {
return false;
}
}

@@ -323,2 +333,3 @@

// todo whargarbl implement data stuff
// todo major incomplete whargarbl comeback
if (this.valid_transition(newState, newData)) {

@@ -336,2 +347,3 @@ this._state = newState;

// todo whargarbl implement data stuff
// todo major incomplete whargarbl comeback
if (this.valid_force_transition(newState, newData)) {

@@ -347,4 +359,21 @@ this._state = newState;

current_action_for(action : mNT) : number | void {
const action_base = this._actions.get(action);
if (action_base) {
return action_base.get(this.state());
} else {
return undefined;
}
}
current_action_edge_for(action : mNT) : JssmTransition<mNT, mDT> | void {
const idx = this.current_action_for(action);
return (idx !== undefined)? this._edges[idx] : undefined;
}
valid_action(action : mNT, newData? : mDT) : boolean {
return false; // major todo whargarbl
// todo whargarbl implement hooks
// todo whargarbl implement data stuff
// todo major incomplete whargarbl comeback
return this.current_action_for(action) !== undefined;
}

@@ -355,2 +384,3 @@

// todo whargarbl implement data stuff
// todo major incomplete whargarbl comeback
return (this.edge(this.state(), newState) !== undefined);

@@ -456,3 +486,3 @@ }

if_obj_field = (obj, field, precarry='') => obj? (obj[field]? (precarry + (obj[field]:any)) : '') : '',
if_obj_field = (obj:any, field) => obj? (obj[field] || '') : '',

@@ -473,3 +503,3 @@ h_final = this.state_is_final(s),

textColor = (final, complete, terminal, _solo_1_2 = '_solo') =>
textColor = (final, complete, terminal, _solo_1_2 = '_solo') : string =>
final ? (vc('text_final' + _solo_1_2)) :

@@ -485,6 +515,6 @@ (complete? (vc('text_complete' + _solo_1_2)) :

// [edge, 'name', 'label', true],
[pair, 'probability', 'headlabel', 'name', double, headColor],
[edge, 'probability', 'taillabel', 'name', true, tailColor]
[pair, 'probability', 'headlabel', 'name', 'action', double, headColor],
[edge, 'probability', 'taillabel', 'name', 'action', true, tailColor]
]
.map( r => ({ which: r[2], whether: (r[4]? ((if_obj_field(r[0], r[1]):any) + ((if_obj_field(r[0], r[3], '<br/>'):any) || '')) : ''), color: r[5] }) )
.map( r => ({ which: r[2], whether: (r[5]? ([(if_obj_field(r[0], r[5]):any), (if_obj_field(r[0], r[1]):any), (if_obj_field(r[0], r[3]):any)].filter(q=>q).join('<br/>') || '') : ''), color: r[6] }) )
.filter( present => present.whether )

@@ -491,0 +521,0 @@ .map( r => `${r.which}=${(r.color)? `<<font color="${(r.color:any)}">${(r.whether : any)}</font>>` : `"${(r.whether : any)}"`};`)

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