xstate 4.30.2 → 4.30.3

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.
package/lib/utils.js CHANGED
@@ -7,9 +7,6 @@ var constants = require('./constants.js');
7
7
  var environment = require('./environment.js');
8
8
 
9
9
  var _a;
10
- function keys(value) {
11
- return Object.keys(value);
12
- }
13
10
  function matchesState(parentStateId, childStateId, delimiter) {
14
11
  if (delimiter === void 0) {
15
12
  delimiter = constants.STATE_DELIMITER;
@@ -31,7 +28,7 @@ function matchesState(parentStateId, childStateId, delimiter) {
31
28
  return parentStateValue in childStateValue;
32
29
  }
33
30
 
34
- return keys(parentStateValue).every(function (key) {
31
+ return Object.keys(parentStateValue).every(function (key) {
35
32
  if (!(key in childStateValue)) {
36
33
  return false;
37
34
  }
@@ -97,7 +94,7 @@ function pathToStateValue(statePath) {
97
94
  }
98
95
  function mapValues(collection, iteratee) {
99
96
  var result = {};
100
- var collectionKeys = keys(collection);
97
+ var collectionKeys = Object.keys(collection);
101
98
 
102
99
  for (var i = 0; i < collectionKeys.length; i++) {
103
100
  var key = collectionKeys[i];
@@ -112,7 +109,7 @@ function mapFilterValues(collection, iteratee, predicate) {
112
109
  var result = {};
113
110
 
114
111
  try {
115
- for (var _b = _tslib.__values(keys(collection)), _c = _b.next(); !_c.done; _c = _b.next()) {
112
+ for (var _b = _tslib.__values(Object.keys(collection)), _c = _b.next(); !_c.done; _c = _b.next()) {
116
113
  var key = _c.value;
117
114
  var item = collection[key];
118
115
 
@@ -207,7 +204,7 @@ function toStatePaths(stateValue) {
207
204
  return [[stateValue]];
208
205
  }
209
206
 
210
- var result = flatten(keys(stateValue).map(function (key) {
207
+ var result = flatten(Object.keys(stateValue).map(function (key) {
211
208
  var subStateValue = stateValue[key];
212
209
 
213
210
  if (typeof subStateValue !== 'string' && (!subStateValue || !Object.keys(subStateValue).length)) {
@@ -366,7 +363,7 @@ function updateContext(context, _event, assignActions, state) {
366
363
  partialUpdate = assignment(acc, _event.data, meta);
367
364
  } else {
368
365
  try {
369
- for (var _b = _tslib.__values(keys(assignment)), _c = _b.next(); !_c.done; _c = _b.next()) {
366
+ for (var _b = _tslib.__values(Object.keys(assignment)), _c = _b.next(); !_c.done; _c = _b.next()) {
370
367
  var key = _c.value;
371
368
  var propAssignment = assignment[key];
372
369
  partialUpdate[key] = isFunction(propAssignment) ? propAssignment(acc, _event.data, meta) : propAssignment;
@@ -420,18 +417,7 @@ function isFunction(value) {
420
417
  }
421
418
  function isString(value) {
422
419
  return typeof value === 'string';
423
- } // export function memoizedGetter<T, TP extends { prototype: object }>(
424
- // o: TP,
425
- // property: string,
426
- // getter: () => T
427
- // ): void {
428
- // Object.defineProperty(o.prototype, property, {
429
- // get: getter,
430
- // enumerable: false,
431
- // configurable: false
432
- // });
433
- // }
434
-
420
+ }
435
421
  function toGuard(condition, guardMap) {
436
422
  if (!condition) {
437
423
  return undefined;
@@ -472,11 +458,7 @@ var interopSymbols = (_a = {}, _a[symbolObservable] = function () {
472
458
  return this;
473
459
  }, _a);
474
460
  function isMachine(value) {
475
- try {
476
- return '__xstatenode' in value;
477
- } catch (e) {
478
- return false;
479
- }
461
+ return !!value && '__xstatenode' in value;
480
462
  }
481
463
  function isActor(value) {
482
464
  return !!value && typeof value.send === 'function';
@@ -610,7 +592,6 @@ exports.isObservable = isObservable;
610
592
  exports.isPromiseLike = isPromiseLike;
611
593
  exports.isStateLike = isStateLike;
612
594
  exports.isString = isString;
613
- exports.keys = keys;
614
595
  exports.mapContext = mapContext;
615
596
  exports.mapFilterValues = mapFilterValues;
616
597
  exports.mapValues = mapValues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xstate",
3
- "version": "4.30.2",
3
+ "version": "4.30.3",
4
4
  "description": "Finite State Machines and Statecharts for the Modern Web.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",