kab/kab/static/js/monaco-yaml/yamlWorker.js
/**
   * Finds the node at the given path in a JSON DOM.
   */
Finds the node at the given path in a JSON DOM.
Finds the node at the given path in a JSON DOM .
function findNodeAtLocation(root, path) {
    if (!root) {
      return void 0;
    }
    var node = root;
    for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {
      var segment = path_1[_i];
      if (typeof segment === 'string') {
        if (node.type !== 'object' || !Array.isArray(node.children)) {
          return void 0;
        }
        var found = false;
        for (var _a = 0, _b = node.children; _a < _b.length; _a++) {
          var propertyNode = _b[_a];
          if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment) {
            node = propertyNode.children[1];
            found = true;
            break;
          }
        }
        if (!found) {
          return void 0;
        }
      }
      else {
        var index = segment;
        if (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
          return void 0;
        }
        node = node.children[index];
      }
    }
    return node;
  }
function findNodeAtLocation ( root , path ) { if ( ! root ) { return void 0 ; } var node = root ; for ( var _i = 0 , path_1 = path ; _i < path_1 . length ; _i ++ ) { var segment = path_1 [ _i ] ; if ( typeof segment === 'string' ) { if ( node . type !== 'object' || ! Array . isArray ( node . children ) ) { return void 0 ; } var found = false ; for ( var _a = 0 , _b = node . children ; _a < _b . length ; _a ++ ) { var propertyNode = _b [ _a ] ; if ( Array . isArray ( propertyNode . children ) && propertyNode . children [ 0 ] . value === segment ) { node = propertyNode . children [ 1 ] ; found = true ; break ; } } if ( ! found ) { return void 0 ; } } else { var index = segment ; if ( node . type !== 'array' || index < 0 || ! Array . isArray ( node . children ) || index >= node . children . length ) { return void 0 ; } node = node . children [ index ] ; } } return node ; }
Finds the node at the given path in a JSON DOM.
Finds the node at the given path in a JSON DOM .