Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = require("./utils"); var constants_1 = require("./constants"); function matchesState(parentStateId, childStateId, delimiter) { if (delimiter === void 0) { delimiter = constants_1.STATE_DELIMITER; } var parentStateValue = utils_1.toStateValue(parentStateId, delimiter); var childStateValue = utils_1.toStateValue(childStateId, delimiter); if (typeof childStateValue === 'string') { if (typeof parentStateValue === 'string') { return childStateValue === parentStateValue; } // Parent more specific than child return false; } if (typeof parentStateValue === 'string') { return parentStateValue in childStateValue; } return Object.keys(parentStateValue).every(function (key) { if (!(key in childStateValue)) { return false; } return matchesState(parentStateValue[key], childStateValue[key]); }); } exports.matchesState = matchesState; |