UNPKG

arvo-event-handler

Version:

Type-safe event handler system with versioning, telemetry, and contract validation for distributed Arvo event-driven architectures, featuring routing and multi-handler support.

29 lines (28 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.detectParallelStates = void 0; /** * Detects if an XState machine configuration contains any parallel states. * Uses a stack-based approach for efficient traversal of the state hierarchy. * @param config - XState machine configuration * @returns True if the machine contains at least one parallel state, false otherwise */ var detectParallelStates = function (config) { if (!(config === null || config === void 0 ? void 0 : config.states)) { return false; } var stack = [config]; while (stack.length) { var currentConfig = stack.pop(); if (!(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.states)) continue; if (currentConfig.type === 'parallel') return true; for (var _i = 0, _a = Object.values(currentConfig.states); _i < _a.length; _i++) { var state = _a[_i]; stack.push(state); } } return false; }; exports.detectParallelStates = detectParallelStates;