Parse SMART capabilities information from smartctl output

@param {Array} The data to parse, it has been splitted by lines
@return {Array} All parsed capabilities entries,
each entry contains properties 'Name', 'Value' and 'Annotation'.
172790
function _parseSmartCapabilities(lines) {
        var combineLines = [];
        var strBuf = '';

        /*
         The first line is 'General SMART Values:', it should be discarded.

         Some of the entry information is divided into multiline,
         so first we try to combine these lines to achieve a regular patter.
         Below is the example data:

         Offline data collection status:  (0x84)  Offline data collection activity
         was suspended by an interrupting command from host.
         Auto Offline Data Collection: Enabled.
        */
        for (var i = 1; i < lines.length; i+=1) {
            var firstChar = lines[i][0];
            if (firstChar >= 'A' && firstChar <= 'Z') {
                if (strBuf !== '') {
                    combineLines.push(strBuf);
                }
                strBuf = lines[i];
            }
            else {
                if (strBuf[strBuf.length-1] !== '.') {
                    strBuf += ' ';
                }
                strBuf += lines[i].trim();
            }
        }
        if (strBuf !== '') { // if this is ignored, the last capabilities entry will be missed.
            combineLines.push(strBuf);
        }

        //After combination, each line will become something like this:
        //name:  (0x84)  annotation1.annotation2.annotation3
        var result = [];
        _.forEach(combineLines, function(line) {
            var arr = line.split(/:\s*\(\s*(\w+)\)\s*/);
            var annotation = (arr[2] ? arr[2].split('.') : []);
            if (annotation.length > 0 && annotation[annotation.length-1].length === 0) {
                annotation.pop();
            }
            result.push({
                'Name'  : arr[0],
                'Value' : arr[1] || '',
                'Annotation' : annotation
            });
        });
        return result;
    }
1033295
function normalizeData(data) {
  // Package.json
  if (data.buddy) data = data.buddy;
  // Handle super simple mode
  if (data.input) data = { build: [data] };
  return data;
}
682544
function(data) {
    var tagDict = {};

    if (data.tags) {
      each(data.tags, function(tag) {
        tagDict[tag.title] = tag.value;
      });
    }

    return tagDict;
  }
1267627
def parse(data, options = {})

      return nil if data.nil? || data == ""
      json = get_json_structure(data, options)
      parse_json(json)

    end
1299991
function(data) {
    var flat_data = [];

    if (typeof data.length === 'undefined') {
      if (typeof data === 'object') {
        for (var key in data) {
          if (data.hasOwnProperty(key))
            flat_data = flat_data.concat(this.flatten(data[key]));
        }
      } else {
        return [];
      }
    }

    for (var i = 0; i < data.length; i++) {
      if (typeof data[i].length === 'number') {
        flat_data = flat_data.concat(this.flatten(data[i]));
      } else {
        flat_data.push(data[i]);
      }
    }
    return flat_data;
  }
234068
function parseTextData(text) {
    var data = String(text).replace(/(\r\n|\r|\n)/g, '\n');
    var lines = data.split(/\n/), line;

    var output = '';
    for (var i = 0, l = lines.length; i < l; ++i) {
        line = lines[i];

        output += 'data: ' + line;
        output += (i + 1) === l ? '\n\n' : '\n';
    }

    return output;
}
969099
function parse(string) {
    var result = {},
        lines = string.split(/\r\n|\r|\n/),
        count = lines.length,
        pieces,
        key,
        value,
        meta,
        namespace;

    for (var i = 0; i < count; i++) {
        if (lines[i] === '') {
            continue;
        }
        if (lines[i].toUpperCase() === PREFIX || lines[i].toUpperCase() === POSTFIX) {
            continue;
        }
        var data = lines[i];

        /**
         * Check that next line continues current
         * @param {number} i
         * @returns {boolean}
         */
        var isValueContinued = function (i) {
            return i + 1 < count && (lines[i + 1][0] === ' ' || lines[i + 1][0] === '\t');
        };
        // handle multiline properties (i.e. photo).
        // next line should start with space or tab character
        if (isValueContinued(i)) {
            while (isValueContinued(i)) {
                data += lines[i + 1].trim();
                i++;
            }
        }

        pieces = data.split(':');
        key = pieces.shift();
        value = pieces.join(':');
        namespace = false;
        meta = {};

        // meta fields in property
        if (key.match(/;/)) {
            key = key
                .replace(/\\;/g, 'ΩΩΩ')
                .replace(/\\,/, ',');
            var metaArr = key.split(';').map(function (item) {
                return item.replace(/ΩΩΩ/g, ';');
            });
            key = metaArr.shift();
            metaArr.forEach(function (item) {
                var arr = item.split('=');
                arr[0] = arr[0].toLowerCase();
                if (arr[0].length === 0) {
                    return;
                }
                if (meta[arr[0]]) {
                    meta[arr[0]].push(arr[1]);
                } else {
                    meta[arr[0]] = [arr[1]];
                }
            });
        }

        // values with \n
        value = value
            .replace(/\\n/g, '\n');

        value = tryToSplit(value);

        // Grouped properties
        if (key.match(/\./)) {
            var arr = key.split('.');
            key = arr[1];
            namespace = arr[0];
        }

        var newValue = {
            value: value
        };
        if (Object.keys(meta).length) {
            newValue.meta = meta;
        }
        if (namespace) {
            newValue.namespace = namespace;
        }

        if (key.indexOf('X-') !== 0) {
            key = key.toLowerCase();
        }

        if (typeof result[key] === 'undefined') {
            result[key] = [newValue];
        } else {
            result[key].push(newValue);
        }

    }

    return result;
}
695443
function(data) {
		if( typeof data == "string" ) {
			var transformed = {};
			$.each(data.split(/\s/), function() {
				transformed[this] = true;
			});
			data = transformed;
		}
		return data;
	}
540335
function parse(data){
			var out = {};
        	if(data.type && data.type === 'User'){

        		// map data into ufData format from api json
        		if(data.name && data.name !== '') {out.name = data.name};
        		if(data.username && data.username !== '') {out.nickname = data.username};
        		if(data.blog && data.blog !== '') {
        			if(!out.url) {out.url =[]}
        			out.url.push(data.blog);
        		};
        		if(data.html_url && data.html_url !== '') {
        			if(!out.url) {out.url =[]}
        			out.url.push(data.html_url);
        		};
        		if(data.bio !== null) {out.note = [data.bio]};
        		if(data.location && data.location !== '') {out.label = [data.location]};
				if(data.company && data.company !== '') {out['organization-name'] = [data.company]};
				if(data.avatar_url && data.avatar_url !== '') {out.photo = [data.avatar_url]}; 
				if(data.email && data.email !== '') {out.email = [data.email]};
        		
			}
			return {type: ['h-card'], properties: out};
		}
557938
function parseOutput(str, callback) {
  var err   = null;
  var wifis = [];

  try {
    var blocks = str.split(cellRegex);

    blocks.forEach(block => {
      var network = {};
      var lines   = block.split('\n');
      if (macRegex.exec(lines[0])) {
        // First line is the mac address (always! (?))
        network.mac = lines[0].trim();

        lines.forEach(line => {
          // SSID
          if (line.indexOf('ESSID:') > 0) {
            network.ssid = _.trim(line.split(':')[1], '"');
            if (_.startsWith(network.ssid, '\\x00')) {
              // The raspi 3 interprets a string terminator as character, it's an empty SSID
              network.ssid = '';
            }
          }

          // Channel, an ugly thing to get it
          else if (_.startsWith(line.trim(), 'Frequency:')) {
            network.channel = parseInt(_.trim(line, ' )').split(/Channel/)[1], 10);
          }
            
          // Another ugly thing, the signal which can have different formats, even worse als
          // having different identifiers
          else if (line.indexOf('Signal level') > -1) {
            if (line.indexOf('Quality') > -1) {
              // This is a "Quality=40/70  Signal level=-70 dBm" line
              network.rssi = parseInt(line.substr(line.indexOf('Signal level') + 13), 10);
            }
            else {
              // This is a "Signal level=60/100" line
              var elements = line.split('=');
              elements.forEach(e => {
                if (e.indexOf('/') > 0) {
                  // that's our part
                  var parts    = e.split('/');
                  var level    = Math.floor(100 * parseInt(parts[0], 10) / parseInt(parts[1], 10));
                  network.rssi = level / 2 - 100;
                }
              })
            }
          }
        });
        wifis.push(network);
      }
    });
  }
  catch (ex) {
    err = ex;
  }

  callback(err, wifis);
}
1065255
function (data) {
    var schema = this.schema;
    if (typeof data === 'string') { return data; }
    if (this.isSingleProperty) { return stringifyProperty(data, schema); }
    data = stringifyProperties(data, schema);
    return styleParser.stringify(data);
  }
1248657
function parseVendors(data) {
		var out = {};
		Object.keys(data.agents).forEach(function(name) {
			var agent = data.agents[name];
			out[name] = {
				prefix: agent.prefix,
				versions: agent.versions
			};
		});
		return out;
	}
270382
function(data) {
        if (data === null) {
            return [];
        } else if (Array.isArray(data)) {
            return data.map(this.validateItem, this);
        } else {
            throw new Error('Data for MultiSelectivity instance should be an array');
        }
    }
377319
function (data) {
      var outputData = ''
      if (!(typeof data === 'object')) {
        data = {}
      }

      // Define smarty inside data and copy smarty vars, so one can use $smarty
      // vars inside templates.
      data.smarty = {}
      objectMerge(data.smarty, this.smarty)

      // Take default global modifiers, add with local default modifiers.
      // Merge them and keep them cached.
      this.globalAndDefaultModifiers = jSmart.prototype.defaultModifiersGlobal.concat(this.defaultModifiers)

      // Take default global filters, add with local default filters.
      // Merge them and keep them cached.
      this.globalAndDefaultFilters = jSmart.prototype.filtersGlobal.variable.concat(this.filters.variable)

      jSmartProcessor.clear()
      jSmartProcessor.plugins = this.plugins
      jSmartProcessor.modifiers = this.modifiers
      jSmartProcessor.defaultModifiers = this.defaultModifiers
      jSmartProcessor.escapeHtml = this.escapeHtml
      jSmartProcessor.variableFilters = this.globalAndDefaultFilters
      jSmartProcessor.runTimePlugins = this.runTimePlugins
      jSmartProcessor.blocks = this.blocks
      jSmartProcessor.outerBlocks = this.outerBlocks
      jSmartProcessor.debugging = this.debugging

      // Capture the output by processing the template.
      outputData = jSmartProcessor.getProcessed(this.tree, data, this.smarty)

      // Merge back smarty data returned by process to original object.
      objectMerge(this.smarty, outputData.smarty)
      // Apply post filters to output and return the template data.
      return this.applyFilters(jSmart.prototype.filtersGlobal.post.concat(this.filters.post), outputData.output)
    }
1237340
function parse(data) {
  if (Array.isArray(data)) {
    for (var i=0; i<data.length; i++) {
      data[i] = parse(data[i]);
    }
  } else {
    for (var key in data) {
      if (Array.isArray(data[key]) || typeof data[key] == 'object')
        data[key] = parse(data[key]);

      if (exports.dateKeys.indexOf(key) > -1)
        data[key] = parseISODate(data[key]);
    }
  }

  return data;
}
251694
function parse(data, options, next) {
    data = this.get(data);

    if ('function' === typeof options) {
      next = options;
      options = {};
    }

    //
    // We cannot detect a license so we call the callback without any arguments
    // which symbolises a failed attempt.
    //
    if (!data) return next();

    debug('found %s in the package contents', data);

    // @TODO handle the edge case where people give us an URL instead of an
    // actual license.
    next(undefined, this.normalize(data));
  }
955735
function _parseSmartSelfAssessment(lines) {
        /*
          Example 1:

          === START OF READ SMART DATA SECTION ===
          SMART overall-health self-assessment test result: PASSED

          Example 2:

          === START OF READ SMART DATA SECTION ===
          SMART Health Status: OK
        */
        var result = {};
        //ignore the first line
        for (var i = 1; i < lines.length; i+=1) {
            _parseSmartColonLine(lines[i], result);
        }
        return result;
    }