Comparing version 2.0.0 to 2.0.1
@@ -1,3 +0,8 @@ | ||
import { IStateNodeConfig, IHistory, StateValue } from './types'; | ||
export declare function createHistory(config: IStateNodeConfig): IHistory | undefined; | ||
export declare function updateHistory(history: IHistory, stateValue: StateValue): IHistory; | ||
import { IStateNodeConfig, IHistory, StateValue } from "./types"; | ||
export declare function createHistory( | ||
config: IStateNodeConfig | ||
): IHistory | undefined; | ||
export declare function updateHistory( | ||
history: IHistory, | ||
stateValue: StateValue | ||
): IHistory; |
{ | ||
"name": "xstate", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Simple JavaScript Finite State Machines and Statecharts", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -16,12 +16,11 @@ import { StateNode } from "./index"; | ||
const { states } = node; | ||
const nodes = Object.keys(states).reduce( | ||
(accNodes: StateNode[], stateKey) => { | ||
const subState = states[stateKey]; | ||
const subNodes = getNodes(states[stateKey]); | ||
const nodes = Object.keys( | ||
states | ||
).reduce((accNodes: StateNode[], stateKey) => { | ||
const subState = states[stateKey]; | ||
const subNodes = getNodes(states[stateKey]); | ||
accNodes.push(subState, ...subNodes); | ||
return accNodes; | ||
}, | ||
[] | ||
); | ||
accNodes.push(subState, ...subNodes); | ||
return accNodes; | ||
}, []); | ||
@@ -28,0 +27,0 @@ return nodes; |
@@ -150,5 +150,3 @@ import { getActionType, toStatePath, toTrie, mapValues } from "./utils"; | ||
throw new Error( | ||
`Cannot read '${HISTORY_KEY}' from state '${ | ||
currentState.id | ||
}': missing 'initial'` | ||
`Cannot read '${HISTORY_KEY}' from state '${currentState.id}': missing 'initial'` | ||
); | ||
@@ -166,5 +164,3 @@ } | ||
throw new Error( | ||
`Action '${action}' on state '${ | ||
currentPath | ||
}' leads to undefined state '${nextPath}'.` | ||
`Action '${action}' on state '${currentPath}' leads to undefined state '${nextPath}'.` | ||
); | ||
@@ -171,0 +167,0 @@ } |
@@ -58,5 +58,5 @@ import { assert } from "chai"; | ||
it(`should go from ${fromState} to ${JSON.stringify(toState)} on ${ | ||
actionTypes | ||
}`, () => { | ||
it(`should go from ${fromState} to ${JSON.stringify( | ||
toState | ||
)} on ${actionTypes}`, () => { | ||
const resultState = testMultiTransition( | ||
@@ -63,0 +63,0 @@ machine, |
@@ -7,3 +7,4 @@ import { assert } from 'chai'; | ||
getAdjacencyMap, | ||
getShortestPaths | ||
getShortestPaths, | ||
IPathMap | ||
} from '../src/graph'; | ||
@@ -178,3 +179,3 @@ | ||
assert.lengthOf( | ||
getShortestPaths(lightMachine)[ | ||
(getShortestPaths(lightMachine) as IPathMap)[ | ||
`${lightMachine.id}.${lightMachine.initial}` | ||
@@ -181,0 +182,0 @@ ], |
@@ -80,2 +80,6 @@ import { assert } from 'chai'; | ||
}); | ||
it('should mix/match string state values and object state values', () => { | ||
assert.ok(matchesState('a.b.c', {a: {b: 'c'}})); | ||
}); | ||
}); |
@@ -8,3 +8,3 @@ { | ||
"noUnusedParameters": true, | ||
"strictNullChecks": true, // change to true | ||
"strictNullChecks": true, | ||
"outDir": "./lib", | ||
@@ -11,0 +11,0 @@ "moduleResolution": "node", |
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
289326
6174