Reformat passed arguments into an array of line string
@param {String|Array<String>} string -
@return {Array<String>}
519491
function formatString (string) {
    const separator = "\n";
    return Array.isArray(string) ?
        string.reduce((acc, line) => acc.concat(line.split(separator)), []) :
        string.split(separator);
}
1201708
function formatParameters(params)
{
    var sortedKeys = [],
        formattedParams = ''

    // sort the properties of the parameters
    sortedKeys = _.keys(params).sort()

    // create a string of key value pairs separated by '&' with '=' assignement
    for (i = 0; i < sortedKeys.length; i++)
    {
        if (i !== 0) {
            formattedParams += '&'
        }
        formattedParams += sortedKeys[i] + '=' + params[sortedKeys[i]]
    }

    return formattedParams
}
24516
function(str, indent) {
			var lines = str.split("\n");
			for (var i=0; i<lines.length; i++)
				lines[i] = indent + lines[i];
			return lines.join("\n");
		}
403194
function(string, options) {
      options = options || {};
      var separator = options.separator || '_';
      var split = options.split || /(?=[A-Z])/;

      return string.split(split).join(separator);
    }
58027
protected function fetchLines(string $string, bool $cutIndents): array
    {
        if ($cutIndents) {
            $string = self::normalizeIndents($string, "");
        }

        $lines = explode("\n", self::normalizeEndings($string, false));

        //Pre-processing
        return array_map([$this, 'prepareLine'], $lines);
    }
1174191
function formatPost(post){
  var lines=post.split('\n');
  var result = '<h1>'+lines[0]+'</h1>'
              + '<h2>'+lines[1]+'</h2>';
  for(var i=2;i<lines.length;i++)
      result +='<p>'+lines[i]+'</p>';
  
  return result;
}
378761
function getFormatStringFrom (formattedString) {
      var chunks = formattedString.match(R_FORMAT_CHUNKS);

      if (!chunks) {
        // chunks will be null if there were no tokens to parse in
        // formattedString (for example, if formattedString is '2').  Coerce
        // chunks to be useful here.
        chunks = ['', ''];

        // If there is only one chunk, assume that the string is a number
        // followed by a token...
        // NOTE: This may be an unwise assumption.
      } else if (chunks.length === 1 ||
          // ...or if the string starts with a number component (".", "-", or a
          // digit)...
          formattedString[0].match(R_NUMBER_COMPONENT)) {
        // ...prepend an empty string here to make sure that the formatted number
        // is properly replaced by VALUE_PLACEHOLDER
        chunks.unshift('');
      }

      return chunks.join(VALUE_PLACEHOLDER);
    }
777270
function trimLines(text) {
    let linebreak = determineLinebreaks(text);
    if (linebreak === "") return text;

    let lines = [];
    lines = text.split(linebreak);
    text = "";

    for (let i = 0; i < lines.length; i++) {
        let line = lines[i];

        while (true) {
            let lastChar = line.slice(line.length-1, line.length);
            let repeat = false;

            switch (lastChar) {
                case " ":
                case "\t":
                    line = line.slice(0, -1)
                    repeat = true;
            }

            if (!repeat) break;
        }

        text += line + linebreak;
    }

    return text;
}
123292
function format(str, ...args) {
  return !args.length ? str : str.replace(/%[a-zA-Z]/, (match) => args.shift() || match);
}
180071
function trimLine(line) {
	if (!line) {
		return null;
	}

	if (Array.isArray(line)) {
		return line.map(trimLine);
	}

	return String(line).trim();
}
598707
function formatMsg(){

        return Array.prototype.slice.call( arguments ) .concat([ " (at ", linen, ":", linec, ")." ]) .join( "" );
    }
975810
function arrayToString( ... args ) {
	if ( ! args.length ) { return '/' + this.map( mapValue ).join( '/' ) ; }
	return '/' +  Array.prototype.slice.call( this , ... args ).map( mapValue )
		.join( '/' ) ;
}
1004518
function format(str, formats) {
	let cachedFormats = formats;

	if (!Ember.isArray(cachedFormats) || arguments.length > 2) {
		cachedFormats = new Array(arguments.length - 1);

		for (let i = 1, l = arguments.length; i < l; i++) {
			cachedFormats[i - 1] = arguments[i];
		}
	}

	let idx = 0;
	return str.replace(/%@([0-9]+)?/g, function(s, argIndex) {
		argIndex = (argIndex) ? parseInt(argIndex, 10) - 1 : idx++;
		s = cachedFormats[argIndex];
		return (s === null) ? '(null)' : (s === undefined) ? '' : Ember.inspect(s);
	});
}
444410
function formatList(raw) {
    var list;

    if (!raw) {
        return [];
    }

    list = raw.replace(/\(.+?\)/g, '').split(', ');
    list = list.map(function (item) {
        return item.trim();
    });

    return list;
}
249024
function format(string, args) {
    if (
        string.length === 0 ||
        !args ||
        Object.keys(args).length === 0
    ) {
        return string;
    }
    var matchVar = '[0-9a-zA-Z_$\\.]+',
        matchBrackets = '\\[[^\\]]*\\]',
        matchParsing = new RegExp(
            //"^" +
            "((" + matchVar + "|" + matchBrackets + ")*)" + //Match arg path
            "(!([rsa]))?" + //Conversion
            "(:([^\\?\\!]+))?" //spec
            //"$"
        ),
        matchCount = 0;

    return string.replace(FORMAT_EXPRESSION, function (_, match) {
        var parts = match.match(matchParsing),
            argName = parts[1] || matchCount,
            conversion = parts[4] || 's', //Default is string conversion
            formatSpec = parts[6],
            value = formatArgGet(args, argName);

        matchCount += 1;
        if (value === undefined) {
            return FORMAT_EXPRESSION_START + match + FORMAT_EXPRESSION_STOP;//Replace unchanged
        }

        if (formatSpec && formatSpec.length > 0) {
            value = formatValueSpec(value, formatSpec);
        }

        //Conversion s, r or a
        switch (conversion) {
        case 's':
            return '' + value;
        case 'r':
            return inspect(value);
        case 'a':
            throw new Error('Not yet implemented conversion "' + conversion + '"');
        default:
            throw new Error('Invalid conversion "' + conversion + '"');
        }


    });
}
1117769
function eachLine(str, callback)
    {
        var lines = splitLines(str);

        for (var i = 0; i < lines.length; i++)
            lines[i] = callback(lines[i], i);

        // include \r to enable copy-paste on windows (ie8) without getting everything on one line
        return lines.join('\r\n');
    }
1269868
function format(f) {
    "use strict";
    var i = 1;
    var args = arguments;
    var len = args.length;
    var str = String(f).replace(/%[sdj%]/g, function _replace(x) {
        if (i >= len) return x;
        switch (x) {
        case '%s':
            return String(args[i++]);
        case '%d':
            return Number(args[i++]);
        case '%j':
            return JSON.stringify(args[i++]);
        case '%%':
            return '%';
        default:
            return x;
        }
    });
    for (var x = args[i]; i < len; x = args[++i]) {
        if (x === null || typeof x !== 'object') {
            str += ' ' + x;
        } else {
            str += '[obj]';
        }
    }
    return str;
}