function loadGithub(data) {
    const string = window.atob(data.content);
    return new Promise(function(resolve, reject) {
      if (!_.isString(string)) {
        throw new TypeError('load function only accepts a string');
      }
      metadata.filepath = data.file_path;
      metadata.ref = data.ref;
      console.log('loadGithub Value is ' + JSON.stringify(metadata) + 'saving...');
      Storage.saveMeta('metadata', metadata);

      try {
        JSON.parse(string);
      } catch (error) {
        // Do not change to JSON if it is YAML, and
        // just resolve it
        resolve(string);
        return;
      }

      YAML.load(string, function(error, json) {
        if (error) {
          return reject(error);
        }

        YAML.dump(json, function(error, yamlString) {
          if (error) {
            return reject(error);
          }
          resolve(yamlString);
        });
      });
    });
  }
/**
   * takes a JSON or YAML string, returns YAML string
   *
   * @param {string} data - the Gitlab file object
   * @return {Promise} YAML string and metadata
   * @throws {TypeError} - resolves to a YAML string
  */
takes a JSON or YAML string, returns YAML string
@param {string} data - the Gitlab file object
@return {Promise} YAML string and metadata
@throws {TypeError} - resolves to a YAML string
takes a JSON or YAML string returns YAML string @param { string } data - the Gitlab file object @return { Promise } YAML string and metadata @throws { TypeError } - resolves to a YAML string
function loadGithub(data) {
    const string = window.atob(data.content);
    return new Promise(function(resolve, reject) {
      if (!_.isString(string)) {
        throw new TypeError('load function only accepts a string');
      }
      metadata.filepath = data.file_path;
      metadata.ref = data.ref;
      console.log('loadGithub Value is ' + JSON.stringify(metadata) + 'saving...');
      Storage.saveMeta('metadata', metadata);
      try {
        JSON.parse(string);
      } catch (error) {
        resolve(string);
        return;
      }
      YAML.load(string, function(error, json) {
        if (error) {
          return reject(error);
        }
        YAML.dump(json, function(error, yamlString) {
          if (error) {
            return reject(error);
          }
          resolve(yamlString);
        });
      });
    });
  }
function loadGithub ( data ) { const string = window . atob ( data . content ) ; return new Promise ( function ( resolve , reject ) { if ( ! _ . isString ( string ) ) { throw new TypeError ( 'load function only accepts a string' ) ; } metadata . filepath = data . file_path ; metadata . ref = data . ref ; console . log ( 'loadGithub Value is ' + JSON . stringify ( metadata ) + 'saving...' ) ; Storage . saveMeta ( 'metadata' , metadata ) ; try { JSON . parse ( string ) ; } catch ( error ) { resolve ( string ) ; return ; } YAML . load ( string , function ( error , json ) { if ( error ) { return reject ( error ) ; } YAML . dump ( json , function ( error , yamlString ) { if ( error ) { return reject ( error ) ; } resolve ( yamlString ) ; } ) ; } ) ; } ) ; }
takes a JSON or YAML string, returns YAML string
 @param {string} data - the Gitlab file object
 @return {Promise} YAML string and metadata
 @throws {TypeError} - resolves to a YAML string
takes a JSON or YAML string returns YAML string @param { string } data - the Gitlab file object @return { Promise } YAML string and metadata @throws { TypeError } - resolves to a YAML string
// Do not change to JSON if it is YAML, and // just resolve it