Comparing version 0.2.4 to 0.2.5
@@ -35,2 +35,3 @@ 'use strict'; | ||
let reduce = fnType.bind(reduceType); | ||
let action = fn => reduce((ctx, ev) => { fn(ctx, ev); return ctx; }); | ||
@@ -44,12 +45,6 @@ let guardType = {}; | ||
function extractActions(args) { | ||
function makeTransition(from, to, ...args) { | ||
let guards = stack(filter(guardType, args).map(t => t.fn), truthy, callBoth); | ||
let reducers = stack(filter(reduceType, args).map(t => t.fn), identity, callForward); | ||
return [guards, reducers]; | ||
} | ||
let transitionType = {}; | ||
function transition(from, to, ...args) { | ||
let [guards, reducers] = extractActions(args); | ||
return create(transitionType, { | ||
return create(this, { | ||
from: valueEnumerable(from), | ||
@@ -62,11 +57,6 @@ to: valueEnumerable(to), | ||
let transitionType = {}; | ||
let immediateType = {}; | ||
function immediate(to, ...args) { | ||
let [guards, reducers] = extractActions(args); | ||
return create(immediateType, { | ||
to: valueEnumerable(to), | ||
guards: valueEnumerable(guards), | ||
reducers: valueEnumerable(reducers) | ||
}); | ||
} | ||
let transition = makeTransition.bind(transitionType); | ||
let immediate = makeTransition.bind(immediateType, null); | ||
@@ -202,2 +192,3 @@ function enterImmediate(machine, service, event) { | ||
exports.action = action; | ||
exports.createMachine = createMachine; | ||
@@ -204,0 +195,0 @@ exports.d = d; |
@@ -31,2 +31,3 @@ function valueEnumerable(value) { | ||
export let reduce = fnType.bind(reduceType); | ||
export let action = fn => reduce((ctx, ev) => { fn(ctx, ev); return ctx; }); | ||
@@ -40,12 +41,6 @@ let guardType = {}; | ||
function extractActions(args) { | ||
function makeTransition(from, to, ...args) { | ||
let guards = stack(filter(guardType, args).map(t => t.fn), truthy, callBoth); | ||
let reducers = stack(filter(reduceType, args).map(t => t.fn), identity, callForward); | ||
return [guards, reducers]; | ||
} | ||
let transitionType = {}; | ||
export function transition(from, to, ...args) { | ||
let [guards, reducers] = extractActions(args); | ||
return create(transitionType, { | ||
return create(this, { | ||
from: valueEnumerable(from), | ||
@@ -58,11 +53,6 @@ to: valueEnumerable(to), | ||
let transitionType = {}; | ||
let immediateType = {}; | ||
export function immediate(to, ...args) { | ||
let [guards, reducers] = extractActions(args); | ||
return create(immediateType, { | ||
to: valueEnumerable(to), | ||
guards: valueEnumerable(guards), | ||
reducers: valueEnumerable(reducers) | ||
}); | ||
} | ||
export let transition = makeTransition.bind(transitionType); | ||
export let immediate = makeTransition.bind(immediateType, null); | ||
@@ -69,0 +59,0 @@ function enterImmediate(machine, service, event) { |
{ | ||
"name": "robot3", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "A function, immutable Finite State Machine library", | ||
@@ -5,0 +5,0 @@ "main": "dist/machine.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15374
370