convert data to array suitable for sourceData, e.g. [{value: 1, text: 'abc'}, {...}]
778955
function(data) {
            var count, obj, result = [], item, iterateItem;
            if(!data || typeof data === 'string') {
                return null; 
            }

            if($.isArray(data)) { //array
                /* 
                   function to iterate inside item of array if item is object.
                   Caclulates count of keys in item and store in obj. 
                */
                iterateItem = function (k, v) {
                    obj = {value: k, text: v};
                    if(count++ >= 2) {
                        return false;// exit from `each` if item has more than one key.
                    }
                };
            
                for(var i = 0; i < data.length; i++) {
                    item = data[i]; 
                    if(typeof item === 'object') {
                        count = 0; //count of keys inside item
                        $.each(item, iterateItem);
                        //case: [{val1: 'text1'}, {val2: 'text2} ...]
                        if(count === 1) { 
                            result.push(obj); 
                            //case: [{value: 1, text: 'text1'}, {value: 2, text: 'text2'}, ...]
                        } else if(count > 1) {
                            //removed check of existance: item.hasOwnProperty('value') && item.hasOwnProperty('text')
                            if(item.children) {
                                item.children = this.makeArray(item.children);   
                            }
                            result.push(item);
                        }
                    } else {
                        //case: ['text1', 'text2' ...]
                        result.push({value: item, text: item}); 
                    }
                }
            } else {  //case: {val1: 'text1', val2: 'text2, ...}
                $.each(data, function (k, v) {
                    result.push({value: k, text: v});
                });  
            }
            return result;
        }
602384
def standardize_input_data(data):
    
    if type(data) == bytes:
        data = data.decode('utf-8')
    if type(data) == list:
        data = [
            el.decode('utf-8') if type(data) == bytes else el
            for el in data
        ]
    return data
268249
function (data) {
        var items = [];
        data.forEach(function (d, i) {
            if (d.includes('ITEM:') && d.length > 3) {
                var iid = data[i + 1];
                var item = {
                    item: {
                        id: Number(iid[1].trim()),
                        name: d[2].replace(/_/g, ' '),
                        price: d[3],
                        change: d[4]
                    }
                };
                items.push(item);
            }
        });
        return items;
    }
532744
def to_s
     data = [@name.concat(Array.new(32-@name.size, 0)), 
             @name_size, 
             @type, 
             @color, 
             @left, 
             @right, 
             @child, 
             @created,
             @modified, 
             @sector, 
             @size].flatten
      data.pack(PACKING)
    end
1186195
def to_arrays(data, columns, coerce_float=False, dtype=None):
    
    if isinstance(data, ABCDataFrame):
        if columns is not None:
            arrays = [data._ixs(i, axis=1).values
                      for i, col in enumerate(data.columns) if col in columns]
        else:
            columns = data.columns
            arrays = [data._ixs(i, axis=1).values for i in range(len(columns))]

        return arrays, columns

    if not len(data):
        if isinstance(data, np.ndarray):
            columns = data.dtype.names
            if columns is not None:
                return [[]] * len(columns), columns
        return [], []  # columns if columns is not None else []
    if isinstance(data[0], (list, tuple)):
        return _list_to_arrays(data, columns, coerce_float=coerce_float,
                               dtype=dtype)
    elif isinstance(data[0], abc.Mapping):
        return _list_of_dict_to_arrays(data, columns,
                                       coerce_float=coerce_float, dtype=dtype)
    elif isinstance(data[0], ABCSeries):
        return _list_of_series_to_arrays(data, columns,
                                         coerce_float=coerce_float,
                                         dtype=dtype)
    elif isinstance(data[0], Categorical):
        if columns is None:
            columns = ibase.default_index(len(data))
        return data, columns
    elif (isinstance(data, (np.ndarray, ABCSeries, Index)) and
          data.dtype.names is not None):

        columns = list(data.dtype.names)
        arrays = [data[k] for k in columns]
        return arrays, columns
    else:
        # last ditch effort
        data = lmap(tuple, data)
        return _list_to_arrays(data, columns, coerce_float=coerce_float,
                               dtype=dtype)
1167777
function parse(data){
			var out = {};
     		if(data.entry){

	    		var entry = data.entry[0];
	    		
	    		// map data into ufData format from api json

	        	if(utils.getNodeVaue('name.givenName', entry) !== ''){
	        		out['given-name'] = utils.getNodeVaue('name.givenName', entry)
	        	}	

	        	if(utils.getNodeVaue('name.familyName', entry) !== ''){
	        		out['family-name'] = utils.getNodeVaue('name.familyName', entry)
	        	}	

	        	if(utils.getNodeVaue('name.formatted', entry) !== ''){
	        		out.name = utils.getNodeVaue('name.formatted', entry)
	        	}	

	        	if(entry.thumbnailUrl){
	        		out.photo = [entry.thumbnailUrl]
	        	}

	        	if(entry.aboutMe){
	        		out.note = [entry.aboutMe]
	        	}

	        	if(entry.urls){
	        		if(!out.url) {out.url = []};
	        		var i = entry.urls.length;
					var x = 0;
					while (x < i) {
					    out.url.push(entry.urls[x].value);
					    x++;
					}
				}

				if(entry.phoneNumbers){
	        		if(!out.tel) {out.tel = []};
	        		var i = entry.phoneNumbers.length;
					var x = 0;
					while (x < i) {
						if(entry.phoneNumbers[x].type === 'mobile'){
							entry.phoneNumbers[x].type = 'cell'
						}
					    out.tel.push(entry.phoneNumbers[x]);
					    x++;
					}
				}

				if(entry.emails){
	        		if(!out.email) {out.email = []};
	        		var i = entry.emails.length;
					var x = 0;
					while (x < i) {
						if(entry.emails[x].primary && entry.emails[x].primary == 'true'){
							entry.emails[x].type = 'pref';
							delete entry.emails[x].primary;
						}
					    out.email.push(entry.emails[x]);
					    x++;
					}
				}
			}
			return {type: ['h-card'], properties: out};
		}
200362
def array_from_text(self, msg):
        """"""
        rows, columns = self.t.height, self.t.width
        return self.array_from_text_rc(msg, rows, columns)
1268225
function toArray(iterable) {
    // kinda optimisations
    if (isArray(iterable)) {
        return iterable.slice();
    }
    if (typeof iterable === 'string') {
        return iterable.split('');
    }

    var iter = ensureIter(iterable);
    var result = [];
    var next = iter.next();
    while (!next.done) {
        result.push(next.value);
        next = iter.next();
    }
    return result;
}
529856
function to_array(args) {
    var len = args.length,
        arr = new Array(len), i;

    for (i = 0; i < len; i += 1) {
        arr[i] = args[i];
    }

    return arr;
}
341088
private Data[] convertToData(T[] items) {
        if (items == null || items.length == 0) {
            return new Data[0];
        }
        if (items[0] instanceof Data) {
            return (Data[]) items;
        }
        final Data[] ret = new Data[items.length];
        for (int i = 0; i < items.length; i++) {
            ret[i] = convertToData(items[i]);
        }
        return ret;
    }
315594
function implodeDataArray(data) {
	var dataArray = [], i, l;
	l = data.length;
	for(i = 0; i < l; i++) {
		dataArray.push(types.STRING);
		dataArray.push(encodeString(data[i]));
	}
	return implodeArray(dataArray);
}
636023
function parseInputData(data) {
			var keyValRegExPattern = /[a-zA-Z]*:/g;
			var keys = data.match(keyValRegExPattern),
				values = data.split(keyValRegExPattern),
				parsedObject = {};

			// Pop the first blank one off the top
			values.shift();


			for(var i=values.length-1; i >=0; i--) {
				var value = values[i],
					key = keys[i];

				// Trim whitespace
				value = value.trim();

				// Trim any trailing commas
				if(value[value.length-1] === ",") {
					value = value.substring(0, value.length-1);
				}

				// Add to object and trim trailing : from key
				parsedObject[ key.substring(0,key.length-1) ] = value;
			}

			return parsedObject;

		}
446041
function padData(data) {
  let result = []
  for (let [ targetString, ...rest ] of data) {
    // We are testing for up to 3 spaces and for empty strings we’ll use this
    // condition to prevent duplicates.
    if (targetString === '') {
      result.push([ ' ', ...rest ])
      result.push([ '  ', ...rest ])
      result.push([ '   ', ...rest ])
      continue
    }
    // Other strings, add up to 3 spaces to the left and right.
    for (let i = 1; i <= 3; i++) {
      const LENGHT = targetString.length
      // Add spaces to the right.
      result.push([ pad(targetString, LENGHT + i), ...rest ])
      // Add spaces to the left.
      result.push([ pad(LENGHT + i, targetString), ...rest ])
    }
  }
  return result
}
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;
}
1222465
function normalizeSourceSet(data) {
	var sourceSet = data.srcSet || data.srcset;

	if (Array.isArray(sourceSet)) {
		return sourceSet.join();
	}

	return sourceSet;
}
1006428
function iteratorToArray(iterator) {
        var data,
            result = [];

        while (!(data = iterator.next()).done) {
            result.push(data.value);
        }
        return result;
    }
681691
def to_array(self):
        
        array = super(PassportElementErrorDataField, self).to_array()
        array['source'] = u(self.source)  # py2: type unicode, py3: type str
        array['type'] = u(self.type)  # py2: type unicode, py3: type str
        array['field_name'] = u(self.field_name)  # py2: type unicode, py3: type str
        array['data_hash'] = u(self.data_hash)  # py2: type unicode, py3: type str
        array['message'] = u(self.message)  # py2: type unicode, py3: type str
        return array