kab/kab/static/js/monaco-yaml/yamlWorker.js
/**
   * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
   * Therefore always check the errors list to find out if the input was valid.
   */
Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
Therefore always check the errors list to find out if the input was valid.
Parses the given text and returns the object the JSON content represents . On invalid input the parser tries to be as fault tolerant as possible but still return a result . Therefore always check the errors list to find out if the input was valid .
function parse(text, errors, options) {
    if (errors === void 0) {
      errors = [];
    }
    var currentProperty = null;
    var currentParent = [];
    var previousParents = [];
    function onValue(value) {
      if (Array.isArray(currentParent)) {
        currentParent.push(value);
      }
      else if (currentProperty) {
        currentParent[currentProperty] = value;
      }
    }
    var visitor = {
      onObjectBegin: function () {
        var object = {};
        onValue(object);
        previousParents.push(currentParent);
        currentParent = object;
        currentProperty = null;
      },
      onObjectProperty: function (name) {
        currentProperty = name;
      },
      onObjectEnd: function () {
        currentParent = previousParents.pop();
      },
      onArrayBegin: function () {
        var array = [];
        onValue(array);
        previousParents.push(currentParent);
        currentParent = array;
        currentProperty = null;
      },
      onArrayEnd: function () {
        currentParent = previousParents.pop();
      },
      onLiteralValue: onValue,
      onError: function (error, offset, length) {
        errors.push({ error: error, offset: offset, length: length });
      }
    };
    visit(text, visitor, options);
    return currentParent[0];
  }
function parse ( text , errors , options ) { if ( errors === void 0 ) { errors = [ ] ; } var currentProperty = null ; var currentParent = [ ] ; var previousParents = [ ] ; function onValue ( value ) { if ( Array . isArray ( currentParent ) ) { currentParent . push ( value ) ; } else if ( currentProperty ) { currentParent [ currentProperty ] = value ; } } var visitor = { onObjectBegin : function ( ) { var object = { } ; onValue ( object ) ; previousParents . push ( currentParent ) ; currentParent = object ; currentProperty = null ; } , onObjectProperty : function ( name ) { currentProperty = name ; } , onObjectEnd : function ( ) { currentParent = previousParents . pop ( ) ; } , onArrayBegin : function ( ) { var array = [ ] ; onValue ( array ) ; previousParents . push ( currentParent ) ; currentParent = array ; currentProperty = null ; } , onArrayEnd : function ( ) { currentParent = previousParents . pop ( ) ; } , onLiteralValue : onValue , onError : function ( error , offset , length ) { errors . push ( { error : error , offset : offset , length : length } ) ; } } ; visit ( text , visitor , options ) ; return currentParent [ 0 ] ; }
Parses the given text and returns the object the JSON content represents.
Parses the given text and returns the object the JSON content represents .