All files / xstate/lib mapState.js

42.86% Statements 3/7
0% Branches 0/5
0% Functions 0/2
42.86% Lines 3/7

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  1x 1x                     1x  
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("./utils");
function mapState(stateMap, stateId) {
    var foundStateId;
    utils_1.keys(stateMap).forEach(function (mappedStateId) {
        if (utils_1.matchesState(mappedStateId, stateId) &&
            (!foundStateId || stateId.length > foundStateId.length)) {
            foundStateId = mappedStateId;
        }
    });
    return stateMap[foundStateId];
}
exports.mapState = mapState;