jssm 5.35.4 → 5.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.codeclimate.yml +22 -22
  2. package/.editorconfig +12 -12
  3. package/.eslintrc +20 -20
  4. package/.nycrc +6 -6
  5. package/.travis.yml +8 -8
  6. package/LICENSE.md +21 -21
  7. package/README.md +997 -993
  8. package/dist/es6/jssm-dot.d.ts +6 -6
  9. package/dist/es6/jssm-dot.js +1 -1
  10. package/dist/es6/jssm.d.ts +100 -100
  11. package/dist/es6/jssm.js +792 -792
  12. package/dist/es6/jssm_types.d.ts +151 -151
  13. package/dist/es6/jssm_types.js +1 -1
  14. package/dist/es6/jssm_util.d.ts +8 -8
  15. package/dist/es6/jssm_util.js +34 -34
  16. package/dist/es6/version.d.ts +2 -2
  17. package/dist/es6/version.js +2 -2
  18. package/dist/jssm.es5.cjs.js +1 -1
  19. package/dist/jssm.es5.iife.js +1 -0
  20. package/jest-spec.config.js +27 -27
  21. package/jest-stoch.config.js +27 -27
  22. package/jssm-dot.d.ts +6 -6
  23. package/jssm.d.ts +100 -100
  24. package/jssm_types.d.ts +151 -151
  25. package/jssm_util.d.ts +8 -8
  26. package/package.json +125 -122
  27. package/rollup.config.iife.js +44 -44
  28. package/rollup.config.js +44 -44
  29. package/src/demo/index.html +38 -38
  30. package/src/demo/style.css +1 -1
  31. package/src/ts/jssm-dot.peg +928 -874
  32. package/src/ts/jssm.ts +1120 -1120
  33. package/src/ts/jssm_types.ts +346 -346
  34. package/src/ts/jssm_util.ts +100 -100
  35. package/src/ts/tests/actions.spec.ts +167 -167
  36. package/src/ts/tests/arrange.spec.ts +72 -72
  37. package/src/ts/tests/arrange.stoch.ts +4 -4
  38. package/src/ts/tests/array_box_if_string.spec.ts +30 -31
  39. package/src/ts/tests/array_transitions.spec.ts +129 -129
  40. package/src/ts/tests/arrow unicode.spec.ts +88 -88
  41. package/src/ts/tests/arrow.spec.ts +124 -124
  42. package/src/ts/tests/colors.spec.ts +58 -58
  43. package/src/ts/tests/comment.spec.ts +134 -134
  44. package/src/ts/tests/compile.spec.ts +79 -79
  45. package/src/ts/tests/constants.spec.ts +98 -98
  46. package/src/ts/tests/cycles.spec.ts +153 -153
  47. package/src/ts/tests/dot_preamble.spec.ts +16 -16
  48. package/src/ts/tests/embedded_sm.spec.ts +36 -36
  49. package/src/ts/tests/flow.spec.ts +22 -22
  50. package/src/ts/tests/forced transitions.spec.ts +26 -26
  51. package/src/ts/tests/general.spec.ts +933 -933
  52. package/src/ts/tests/graph node lists.spec.ts +21 -21
  53. package/src/ts/tests/histo.spec.ts +24 -24
  54. package/src/ts/tests/hooks.spec.ts +28 -0
  55. package/src/ts/tests/language.spec.ts +37 -37
  56. package/src/ts/tests/language_data/belarussian.json +13 -13
  57. package/src/ts/tests/language_data/bengali.json +15 -15
  58. package/src/ts/tests/language_data/emoji.json +21 -21
  59. package/src/ts/tests/language_data/english.json +16 -16
  60. package/src/ts/tests/language_data/french.json +16 -16
  61. package/src/ts/tests/language_data/german.json +16 -16
  62. package/src/ts/tests/language_data/hebrew.json +16 -16
  63. package/src/ts/tests/language_data/portuguese.json +12 -12
  64. package/src/ts/tests/language_data/russian.json +12 -12
  65. package/src/ts/tests/language_data/spanish.json +17 -17
  66. package/src/ts/tests/language_data/ukrainian.json +18 -18
  67. package/src/ts/tests/layout.spec.ts +29 -29
  68. package/src/ts/tests/machine_attributes.spec.ts +398 -398
  69. package/src/ts/tests/machine_name.spec.ts +14 -14
  70. package/src/ts/tests/named lists.spec.ts +24 -19
  71. package/src/ts/tests/nominated states.spec.ts +133 -133
  72. package/src/ts/tests/parse actions.spec.ts +32 -32
  73. package/src/ts/tests/parse.spec.ts +94 -94
  74. package/src/ts/tests/probability.spec.ts +146 -146
  75. package/src/ts/tests/r639.spec.ts +27 -27
  76. package/src/ts/tests/sample_select.spec.ts +173 -173
  77. package/src/ts/tests/seq.spec.ts +14 -16
  78. package/src/ts/tests/seq.stoch.ts +83 -0
  79. package/src/ts/tests/shapes.spec.ts +63 -63
  80. package/src/ts/tests/sm_tag.spec.ts +37 -37
  81. package/src/ts/tests/special characters.spec.ts +39 -39
  82. package/src/ts/tests/state_declaration.spec.ts +214 -200
  83. package/src/ts/tests/state_style.spec.ts +82 -39
  84. package/src/ts/tests/stop light.spec.ts +157 -157
  85. package/src/ts/tests/stripes.spec.ts +52 -52
  86. package/src/ts/tests/theme.spec.ts +45 -45
  87. package/src/ts/tests/weighted_histo_key.spec.ts +22 -22
  88. package/src/ts/tests/weighted_rand_select.spec.ts +27 -27
  89. package/src/ts/tests/weighted_sample_select.spec.ts +24 -26
  90. package/src/ts/version.ts +1 -1
  91. package/tree.txt +1794 -1794
  92. package/tsconfig.json +27 -27
  93. package/version.d.ts +2 -2
@@ -1,146 +1,146 @@
1
-
2
- /* eslint-disable max-len */
3
-
4
- import * as jssm from '../jssm';
5
-
6
-
7
-
8
-
9
-
10
- describe('probable exits for', () => {
11
-
12
- const machine = new jssm.Machine({
13
- start_states : ['off'],
14
- transitions : [ { from: 'off', to: 'red', kind: 'legal', forced_only: false, main_path: false } ]
15
- });
16
-
17
- test('probable exits are an array', () =>
18
- expect(Array.isArray(machine.probable_exits_for('off')) )
19
- .toBe(true) );
20
-
21
- test('one probable exit in example', () =>
22
- expect(machine.probable_exits_for('off').length)
23
- .toBe(1) );
24
-
25
- test('exit is an object', () =>
26
- expect(typeof machine.probable_exits_for('off')[0])
27
- .toBe('object') );
28
-
29
- test('exit 0 has a string from property', () =>
30
- expect(typeof machine.probable_exits_for('off')[0].from )
31
- .toBe('string') );
32
-
33
- });
34
-
35
-
36
-
37
-
38
-
39
- describe('probable action exits', () => {
40
-
41
- const machine = new jssm.Machine({
42
- start_states : ['off'],
43
- transitions : [
44
- { from:'off', to:'red', action:'on', kind: 'legal', forced_only: false, main_path: false },
45
- { from:'red', to:'off', action:'off', kind: 'legal', forced_only: false, main_path: false }
46
- ]
47
- });
48
-
49
- test('probable action exits are an array', () =>
50
- expect(Array.isArray(machine.probable_action_exits()) )
51
- .toBe(true) );
52
-
53
- test('probable action exit 1 is on', () =>
54
- expect(machine.probable_action_exits()[0].action)
55
- .toBe('on') );
56
-
57
-
58
- test('probable action exits are an array 2', () =>
59
- expect(Array.isArray(machine.probable_action_exits('off')) )
60
- .toBe(true) );
61
-
62
- test('probable action exit 1 is on 2', () =>
63
- expect(machine.probable_action_exits('off')[0].action)
64
- .toBe('on') );
65
-
66
-
67
- test('probable action exits are an array 3', () =>
68
- expect(Array.isArray(machine.probable_action_exits('red')) )
69
- .toBe(true) );
70
-
71
- test('probable action exit 1 is on 3', () =>
72
- expect(machine.probable_action_exits('red')[0].action)
73
- .toBe('off') );
74
-
75
- });
76
-
77
-
78
-
79
-
80
-
81
- describe('probabilistic_transition', () => {
82
-
83
- const machine = new jssm.Machine({
84
- start_states : ['off'],
85
- transitions : [ { from: 'off', to: 'red', kind: 'legal', forced_only: false, main_path: false } ]
86
- });
87
-
88
- machine.probabilistic_transition();
89
-
90
- test('solo after probabilistic is red', () =>
91
- expect( machine.state() )
92
- .toBe('red') );
93
-
94
- });
95
-
96
-
97
-
98
-
99
-
100
- describe('probabilistic_walk', () => {
101
-
102
- const machine = new jssm.Machine({
103
- start_states : ['off'],
104
- transitions : [
105
- { from: 'off', to: 'red', kind: 'legal', forced_only: false, main_path: false },
106
- { from: 'red', to: 'off', kind: 'legal', forced_only: false, main_path: false }
107
- ]
108
- });
109
-
110
- machine.probabilistic_walk(3);
111
-
112
- test('solo after probabilistic walk 3 is red', () =>
113
- expect( machine.state() )
114
- .toBe('red') );
115
-
116
- });
117
-
118
-
119
-
120
-
121
-
122
- describe('probabilistic_histo_walk', () => {
123
-
124
- const machine = new jssm.Machine({
125
- start_states : ['off'],
126
- transitions : [
127
- { from: 'off', to: 'red', kind: 'legal', forced_only: false, main_path: false },
128
- { from: 'red', to: 'off', kind: 'legal', forced_only: false, main_path: false }
129
- ]
130
- });
131
-
132
- const histo = machine.probabilistic_histo_walk(3);
133
-
134
- test('histo is a Map', () =>
135
- expect(histo instanceof Map)
136
- .toBe(true) );
137
-
138
- test('histo red is 2', () =>
139
- expect(histo.get('red'))
140
- .toBe(2) );
141
-
142
- test('histo off is 2', () =>
143
- expect(histo.get('off'))
144
- .toBe(2) );
145
-
146
- });
1
+
2
+ /* eslint-disable max-len */
3
+
4
+ import * as jssm from '../jssm';
5
+
6
+
7
+
8
+
9
+
10
+ describe('probable exits for', () => {
11
+
12
+ const machine = new jssm.Machine({
13
+ start_states : ['off'],
14
+ transitions : [ { from: 'off', to: 'red', kind: 'legal', forced_only: false, main_path: false } ]
15
+ });
16
+
17
+ test('probable exits are an array', () =>
18
+ expect(Array.isArray(machine.probable_exits_for('off')) )
19
+ .toBe(true) );
20
+
21
+ test('one probable exit in example', () =>
22
+ expect(machine.probable_exits_for('off').length)
23
+ .toBe(1) );
24
+
25
+ test('exit is an object', () =>
26
+ expect(typeof machine.probable_exits_for('off')[0])
27
+ .toBe('object') );
28
+
29
+ test('exit 0 has a string from property', () =>
30
+ expect(typeof machine.probable_exits_for('off')[0].from )
31
+ .toBe('string') );
32
+
33
+ });
34
+
35
+
36
+
37
+
38
+
39
+ describe('probable action exits', () => {
40
+
41
+ const machine = new jssm.Machine({
42
+ start_states : ['off'],
43
+ transitions : [
44
+ { from:'off', to:'red', action:'on', kind: 'legal', forced_only: false, main_path: false },
45
+ { from:'red', to:'off', action:'off', kind: 'legal', forced_only: false, main_path: false }
46
+ ]
47
+ });
48
+
49
+ test('probable action exits are an array', () =>
50
+ expect(Array.isArray(machine.probable_action_exits()) )
51
+ .toBe(true) );
52
+
53
+ test('probable action exit 1 is on', () =>
54
+ expect(machine.probable_action_exits()[0].action)
55
+ .toBe('on') );
56
+
57
+
58
+ test('probable action exits are an array 2', () =>
59
+ expect(Array.isArray(machine.probable_action_exits('off')) )
60
+ .toBe(true) );
61
+
62
+ test('probable action exit 1 is on 2', () =>
63
+ expect(machine.probable_action_exits('off')[0].action)
64
+ .toBe('on') );
65
+
66
+
67
+ test('probable action exits are an array 3', () =>
68
+ expect(Array.isArray(machine.probable_action_exits('red')) )
69
+ .toBe(true) );
70
+
71
+ test('probable action exit 1 is on 3', () =>
72
+ expect(machine.probable_action_exits('red')[0].action)
73
+ .toBe('off') );
74
+
75
+ });
76
+
77
+
78
+
79
+
80
+
81
+ describe('probabilistic_transition', () => {
82
+
83
+ const machine = new jssm.Machine({
84
+ start_states : ['off'],
85
+ transitions : [ { from: 'off', to: 'red', kind: 'legal', forced_only: false, main_path: false } ]
86
+ });
87
+
88
+ machine.probabilistic_transition();
89
+
90
+ test('solo after probabilistic is red', () =>
91
+ expect( machine.state() )
92
+ .toBe('red') );
93
+
94
+ });
95
+
96
+
97
+
98
+
99
+
100
+ describe('probabilistic_walk', () => {
101
+
102
+ const machine = new jssm.Machine({
103
+ start_states : ['off'],
104
+ transitions : [
105
+ { from: 'off', to: 'red', kind: 'legal', forced_only: false, main_path: false },
106
+ { from: 'red', to: 'off', kind: 'legal', forced_only: false, main_path: false }
107
+ ]
108
+ });
109
+
110
+ machine.probabilistic_walk(3);
111
+
112
+ test('solo after probabilistic walk 3 is red', () =>
113
+ expect( machine.state() )
114
+ .toBe('red') );
115
+
116
+ });
117
+
118
+
119
+
120
+
121
+
122
+ describe('probabilistic_histo_walk', () => {
123
+
124
+ const machine = new jssm.Machine({
125
+ start_states : ['off'],
126
+ transitions : [
127
+ { from: 'off', to: 'red', kind: 'legal', forced_only: false, main_path: false },
128
+ { from: 'red', to: 'off', kind: 'legal', forced_only: false, main_path: false }
129
+ ]
130
+ });
131
+
132
+ const histo = machine.probabilistic_histo_walk(3);
133
+
134
+ test('histo is a Map', () =>
135
+ expect(histo instanceof Map)
136
+ .toBe(true) );
137
+
138
+ test('histo red is 2', () =>
139
+ expect(histo.get('red'))
140
+ .toBe(2) );
141
+
142
+ test('histo off is 2', () =>
143
+ expect(histo.get('off'))
144
+ .toBe(2) );
145
+
146
+ });
@@ -1,27 +1,27 @@
1
-
2
- const r639 = require('reduce-to-639-1').reduce;
3
-
4
-
5
-
6
-
7
-
8
- test('should be en', () =>
9
- expect(r639('EnglISh')).toBe('en') );
10
-
11
- test('should be am', () =>
12
- expect(r639('አማርኛ')).toBe('am') );
13
-
14
- test('should be undef when wrong str', () =>
15
- expect( r639('xyzzy') ).toBe(undefined) );
16
-
17
- test('should be undef when empty str', () =>
18
- expect( r639('') ).toBe(undefined) );
19
-
20
-
21
-
22
-
23
-
24
- test.todo('commented out r639 things');
25
-
26
- // describe(`r639 _`, async it => it('should be undef when unnamed', t => t.throws( async() => r639() )));
27
- // describe(`r639 _`, async it => it('should be undef when false', t => t.throws( async() => r639(false) )));
1
+
2
+ const r639 = require('reduce-to-639-1').reduce;
3
+
4
+
5
+
6
+
7
+
8
+ test('should be en', () =>
9
+ expect(r639('EnglISh')).toBe('en') );
10
+
11
+ test('should be am', () =>
12
+ expect(r639('አማርኛ')).toBe('am') );
13
+
14
+ test('should be undef when wrong str', () =>
15
+ expect( r639('xyzzy') ).toBe(undefined) );
16
+
17
+ test('should be undef when empty str', () =>
18
+ expect( r639('') ).toBe(undefined) );
19
+
20
+
21
+
22
+
23
+
24
+ test.todo('commented out r639 things');
25
+
26
+ // describe(`r639 _`, async it => it('should be undef when unnamed', t => t.throws( async() => r639() )));
27
+ // describe(`r639 _`, async it => it('should be undef when false', t => t.throws( async() => r639(false) )));