/*	formatLocationAsPluginName - temporary function -
the current plugins don't provide useful enough, or
consistent meta-data to use for descriptions - so this
function derives what it can from naming patterns seen in
existing commonly used plugin urls.
542699
function formatLocationAsPluginName(location) {
	
		function wordToUpper(strSentence) {
	
			function convertToUpper() {
				return arguments[0].toUpperCase();
			}
	
			return strSentence.toLowerCase().replace(/\b[a-z]/g, convertToUpper);
		}
	
		var divides = location.split("/"); //$NON-NLS-0$
		var last = divides[divides.length - 1];
		last = last.split(".html")[0]; //$NON-NLS-0$
		last = last.replace(/([a-z])([A-Z])/, "$1 $2"); //$NON-NLS-0$
		last = wordToUpper(last);
		last = last.replace('plugin', ''); //$NON-NLS-0$
		last = last.replace('Plugin', ''); //$NON-NLS-0$
	
		if (last === '') {
			last = location;
		} else {
			last = last + ' - ' + location;  //$NON-NLS-0$
		}
		return last;
	}
639586
public static String formatPointLocation(final PointLocation pointLocation,
                                           final PointLocationFormatType formatType)
    throws FormatterException
  {
    if (pointLocation == null)
    {
      throw new FormatterException("No point location provided");
    }
    if (formatType == null)
    {
      throw new FormatterException("No format type provided");
    }

    final String formatted;
    switch (formatType)
    {
      case HUMAN_LONG:
        formatted = pointLocation.toString();
        break;
      case HUMAN_MEDIUM:
        formatted = formatHumanMedium(pointLocation);
        break;
      case HUMAN_SHORT:
        formatted = formatHumanShort(pointLocation);
        break;
      case LONG:
        formatted = formatISO6709Long(pointLocation);
        break;
      case MEDIUM:
        formatted = formatISO6709Medium(pointLocation);
        break;
      case SHORT:
        formatted = formatISO6709Short(pointLocation);
        break;
      case DECIMAL:
        formatted = formatISO6709WithDecimals(pointLocation);
        break;
      default:
        throw new FormatterException("Unsupported format type");
    }

    return formatted;

  }
1008501
protected Format parseAdditionalFormat(
        CmsObject cms,
        I_CmsXmlContentValueLocation location,
        CmsResource functionRes) {

        I_CmsXmlContentValueLocation jspLoc = location.getSubValue("FunctionProvider");
        CmsUUID structureId = jspLoc.asId(cms);
        I_CmsXmlContentValueLocation minWidthLoc = location.getSubValue("MinWidth");
        String minWidth = getStringValue(cms, minWidthLoc, "");
        I_CmsXmlContentValueLocation maxWidthLoc = location.getSubValue("MaxWidth");
        String maxWidth = getStringValue(cms, maxWidthLoc, "");
        I_CmsXmlContentValueLocation typeLoc = location.getSubValue("Type");
        String type = getStringValue(cms, typeLoc, "");
        Map<String, String> parameters = parseParameters(cms, location, "Parameter");
        return new Format(structureId, type, minWidth, maxWidth, parameters);
    }
921952
function formatPath(urlobj)
{
	var path = urlobj.pathname;
	
	if (urlobj.search !== null)
	{
		path += urlobj.search;
	}
	
	return path;
}
625820
function renameImports(format) {
  const suffix = suffixes[format];

  return Object.keys(buildConfig).reduce((accum, name) => {
    accum[name] = './' + buildConfig[name].alias + suffix;
    return accum;
  }, {});
}
966707
function formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo, isPercent) {
    if (isPercent === void 0) { isPercent = false; }
    var formattedText = '';
    var isZero = false;
    if (!isFinite(value)) {
        formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
    }
    else {
        var parsedNumber = parseNumber(value);
        if (isPercent) {
            parsedNumber = toPercent(parsedNumber);
        }
        var minInt = pattern.minInt;
        var minFraction = pattern.minFrac;
        var maxFraction = pattern.maxFrac;
        if (digitsInfo) {
            var parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
            if (parts === null) {
                throw new Error(digitsInfo + " is not a valid digit info");
            }
            var minIntPart = parts[1];
            var minFractionPart = parts[3];
            var maxFractionPart = parts[5];
            if (minIntPart != null) {
                minInt = parseIntAutoRadix(minIntPart);
            }
            if (minFractionPart != null) {
                minFraction = parseIntAutoRadix(minFractionPart);
            }
            if (maxFractionPart != null) {
                maxFraction = parseIntAutoRadix(maxFractionPart);
            }
            else if (minFractionPart != null && minFraction > maxFraction) {
                maxFraction = minFraction;
            }
        }
        roundNumber(parsedNumber, minFraction, maxFraction);
        var digits = parsedNumber.digits;
        var integerLen = parsedNumber.integerLen;
        var exponent = parsedNumber.exponent;
        var decimals = [];
        isZero = digits.every(function (d) { return !d; });
        // pad zeros for small numbers
        for (; integerLen < minInt; integerLen++) {
            digits.unshift(0);
        }
        // pad zeros for small numbers
        for (; integerLen < 0; integerLen++) {
            digits.unshift(0);
        }
        // extract decimals digits
        if (integerLen > 0) {
            decimals = digits.splice(integerLen, digits.length);
        }
        else {
            decimals = digits;
            digits = [0];
        }
        // format the integer digits with grouping separators
        var groups = [];
        if (digits.length >= pattern.lgSize) {
            groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
        }
        while (digits.length > pattern.gSize) {
            groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
        }
        if (digits.length) {
            groups.unshift(digits.join(''));
        }
        formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
        // append the decimal digits
        if (decimals.length) {
            formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');
        }
        if (exponent) {
            formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent;
        }
    }
    if (value < 0 && !isZero) {
        formattedText = pattern.negPre + formattedText + pattern.negSuf;
    }
    else {
        formattedText = pattern.posPre + formattedText + pattern.posSuf;
    }
    return formattedText;
}
581916
private String getLocationName( DroolsParaphraseTypes type ) {
        switch ( type ) {
            case PACKAGE :
                return "package";
            case IMPORT :
                return "import";
            case FUNCTION_IMPORT :
                return "function import";
            case ACCUMULATE_IMPORT :
                return "accumulate import";
            case GLOBAL :
                return "global";
            case FUNCTION :
                return "function";
            case QUERY :
                return "query";
            case TEMPLATE :
                return "template";
            case RULE :
                return "rule";
            case RULE_ATTRIBUTE :
                return "rule attribute";
            case PATTERN :
                return "pattern";
            case EVAL :
                return "eval";
            default :
                return "";
        }
    }
1299190
private static String replacePlaceholders(String containerNamePattern, String imageName, String nameAlias, Date buildTimestamp) {

        Map<String, FormatParameterReplacer.Lookup> lookups = new HashMap<>();

        lookups.put("a", () -> nameAlias);
        lookups.put("n", () -> cleanImageName(imageName));
        lookups.put("t", () -> String.valueOf(buildTimestamp.getTime()));
        lookups.put("i", () -> INDEX_PLACEHOLDER);

        return new FormatParameterReplacer(lookups).replace(containerNamePattern);
    }
772854
function copyPlugin(plugin_src_dir, plugins_dir, link, pluginInfoProvider) {
    var pluginInfo = new PluginInfo(plugin_src_dir);
    var dest = path.join(plugins_dir, pluginInfo.id);
    shell.rm('-rf', dest);
    if (link) {
        events.emit('verbose', 'Symlinking from location "' + plugin_src_dir + '" to location "' + dest + '"');
        shell.mkdir('-p', path.dirname(dest));
        fs.symlinkSync(plugin_src_dir, dest, 'dir');
    } else {
        shell.mkdir('-p', dest);
        events.emit('verbose', 'Copying from location "' + plugin_src_dir + '" to location "' + dest + '"');
        shell.cp('-R', path.join(plugin_src_dir, '*') , dest);
    }
    pluginInfo.dir = dest;
    pluginInfoProvider.put(pluginInfo);

    return dest;
}
846400
function setupCustomPlugin(name, plugin) {
        plugin.active = true;
        plugin.params = EXTEND({}, plugin.params || {});
        plugin.name = name;

        return plugin;
    }
678268
function _formatParameters(parameters) {
    let options = {},
        formatter, value;
    for (let prop in parameters) {
        if (parameters.hasOwnProperty(prop)) {
            if (parameters[prop].domain) {
                let domain = getDomains()[parameters[prop].domain];
                formatter = domain ? domain.format : undefined;
            } else {
                formatter = undefined;
            }
            value = formatter && formatter.value ? formatter.value(parameters[prop].value) : parameters[prop].value;
            options[prop] = value;
        }
    }
    return options;
}
1339286
function stringifyDefectLocation_(defect) {
        var location = defect.location;

        if(location) {
            return util.format('%d:%d\n%s\n%s', location.line, location.column, location.sourceLine,
                new Array(location.column).join('-') + '^'
            );
        }

        return '';
    }
1139181
function formatLine({ rule, message, location }, metrics) {
  const { line, col } = location;
  const { line: lineW, col: colW, message: msgW } = metrics;
  const loc = sprintf(`%${lineW}d:%-${colW}d`, line, col);
  const msg = sprintf(`%-${msgW}s`, message);
  return `  ${loc}  ${msg}  ${rule}`;
}
964226
function(pluginName, moduleName, write){
            if(moduleName in buildMap){
                var content = buildMap[moduleName];
                write('define("'+ pluginName +'!'+ moduleName +'", function(){ return '+ content +';});\n');
            }
        }
1023319
function formatFileName(filepath) {

        var validFilename;

        validFilename = filepath.replace(/\s/g, options.separator);
        validFilename = validFilename.replace(/[^a-zA-Z_0-9.]/, '');
        validFilename = validFilename.toLowerCase();

        return validFilename;
    }
580545
function/* 12.1.1.1 */$$core$$InitializeDateTimeFormat (dateTimeFormat, locales, options) {
        var
        // This will be a internal properties object if we're not already initialized
            internal = $$core$$getInternalProperties(dateTimeFormat),

        // Create an object whose props can be used to restore the values of RegExp props
            regexpState = $$core$$createRegExpRestore();

        // 1. If dateTimeFormat has an [[initializedIntlObject]] internal property with
        //    value true, throw a TypeError exception.
        if (internal['[[initializedIntlObject]]'] === true)
            throw new TypeError('`this` object has already been initialized as an Intl object');

        // Need this to access the `internal` object
        $$core$$defineProperty(dateTimeFormat, '__getInternalProperties', {
            value: function () {
                // NOTE: Non-standard, for internal use only
                if (arguments[0] === $$core$$secret)
                    return internal;
            }
        });

        // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.
        internal['[[initializedIntlObject]]'] = true;

        var
        // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList
        //    abstract operation (defined in 9.2.1) with argument locales.
            requestedLocales = $$core$$CanonicalizeLocaleList(locales),

        // 4. Let options be the result of calling the ToDateTimeOptions abstract
        //    operation (defined below) with arguments options, "any", and "date".
            options = $$core$$ToDateTimeOptions(options, 'any', 'date'),

        // 5. Let opt be a new Record.
            opt = new $$core$$Record();

        // 6. Let matcher be the result of calling the GetOption abstract operation
        //    (defined in 9.2.9) with arguments options, "localeMatcher", "string", a List
        //    containing the two String values "lookup" and "best fit", and "best fit".
            matcher = $$core$$GetOption(options, 'localeMatcher', 'string', new $$core$$List('lookup', 'best fit'), 'best fit');

        // 7. Set opt.[[localeMatcher]] to matcher.
        opt['[[localeMatcher]]'] = matcher;

        var
        // 8. Let DateTimeFormat be the standard built-in object that is the initial
        //    value of Intl.DateTimeFormat.
            DateTimeFormat = $$core$$internals.DateTimeFormat, // This is what we *really* need

        // 9. Let localeData be the value of the [[localeData]] internal property of
        //    DateTimeFormat.
            localeData = DateTimeFormat['[[localeData]]'],

        // 10. Let r be the result of calling the ResolveLocale abstract operation
        //     (defined in 9.2.5) with the [[availableLocales]] internal property of
        //      DateTimeFormat, requestedLocales, opt, the [[relevantExtensionKeys]]
        //      internal property of DateTimeFormat, and localeData.
            r = $$core$$ResolveLocale(DateTimeFormat['[[availableLocales]]'], requestedLocales,
                    opt, DateTimeFormat['[[relevantExtensionKeys]]'], localeData);

        // 11. Set the [[locale]] internal property of dateTimeFormat to the value of
        //     r.[[locale]].
        internal['[[locale]]'] = r['[[locale]]'];

        // 12. Set the [[calendar]] internal property of dateTimeFormat to the value of
        //     r.[[ca]].
        internal['[[calendar]]'] = r['[[ca]]'];

        // 13. Set the [[numberingSystem]] internal property of dateTimeFormat to the value of
        //     r.[[nu]].
        internal['[[numberingSystem]]'] = r['[[nu]]'];

        // The specification doesn't tell us to do this, but it's helpful later on
        internal['[[dataLocale]]'] = r['[[dataLocale]]'];

        var
        // 14. Let dataLocale be the value of r.[[dataLocale]].
            dataLocale = r['[[dataLocale]]'],

        // 15. Let tz be the result of calling the [[Get]] internal method of options with
        //     argument "timeZone".
            tz = options.timeZone;

        // 16. If tz is not undefined, then
        if (tz !== undefined) {
            // a. Let tz be ToString(tz).
            // b. Convert tz to upper case as described in 6.1.
            //    NOTE: If an implementation accepts additional time zone values, as permitted
            //          under certain conditions by the Conformance clause, different casing
            //          rules apply.
            tz = $$core$$toLatinUpperCase(tz);

            // c. If tz is not "UTC", then throw a RangeError exception.
            // ###TODO: accept more time zones###
            if (tz !== 'UTC')
                throw new RangeError('timeZone is not supported.');
        }

        // 17. Set the [[timeZone]] internal property of dateTimeFormat to tz.
        internal['[[timeZone]]'] = tz;

        // 18. Let opt be a new Record.
        opt = new $$core$$Record();

        // 19. For each row of Table 3, except the header row, do:
        for (var prop in $$core$$dateTimeComponents) {
            if (!$$core$$hop.call($$core$$dateTimeComponents, prop))
                continue;

            var
            // 20. Let prop be the name given in the Property column of the row.
            // 21. Let value be the result of calling the GetOption abstract operation,
            //     passing as argument options, the name given in the Property column of the
            //     row, "string", a List containing the strings given in the Values column of
            //     the row, and undefined.
                value = $$core$$GetOption(options, prop, 'string', $$core$$dateTimeComponents[prop]);

            // 22. Set opt.[[<prop>]] to value.
            opt['[['+prop+']]'] = value;
        }

        var
            // Assigned a value below
            bestFormat,

            // 23. Let dataLocaleData be the result of calling the [[Get]] internal method of
            //     localeData with argument dataLocale.
            dataLocaleData = localeData[dataLocale],

            // 24. Let formats be the result of calling the [[Get]] internal method of
            //     dataLocaleData with argument "formats".
            //     Note: we process the CLDR formats into the spec'd structure
            formats = $$core$$ToDateTimeFormats(dataLocaleData.formats),

            // 25. Let matcher be the result of calling the GetOption abstract operation with
            //     arguments options, "formatMatcher", "string", a List containing the two String
            //     values "basic" and "best fit", and "best fit".
            matcher = $$core$$GetOption(options, 'formatMatcher', 'string', new $$core$$List('basic', 'best fit'), 'best fit');

        // Optimization: caching the processed formats as a one time operation by
        // replacing the initial structure from localeData
        dataLocaleData.formats = formats;

        // 26. If matcher is "basic", then
        if (matcher === 'basic')
            // 27. Let bestFormat be the result of calling the BasicFormatMatcher abstract
            //     operation (defined below) with opt and formats.
            bestFormat = $$core$$BasicFormatMatcher(opt, formats);

        // 28. Else
        else
            // 29. Let bestFormat be the result of calling the BestFitFormatMatcher
            //     abstract operation (defined below) with opt and formats.
            bestFormat = $$core$$BestFitFormatMatcher(opt, formats);

        // 30. For each row in Table 3, except the header row, do
        for (var prop in $$core$$dateTimeComponents) {
            if (!$$core$$hop.call($$core$$dateTimeComponents, prop))
                continue;

            // a. Let prop be the name given in the Property column of the row.
            // b. Let pDesc be the result of calling the [[GetOwnProperty]] internal method of
            //    bestFormat with argument prop.
            // c. If pDesc is not undefined, then
            if ($$core$$hop.call(bestFormat, prop)) {
                var
                // i. Let p be the result of calling the [[Get]] internal method of bestFormat
                //    with argument prop.
                    p = bestFormat[prop];

                // ii. Set the [[<prop>]] internal property of dateTimeFormat to p.
                internal['[['+prop+']]'] = p;
            }
        }

        var
            // Assigned a value below
            pattern,

        // 31. Let hr12 be the result of calling the GetOption abstract operation with
        //     arguments options, "hour12", "boolean", undefined, and undefined.
            hr12 = $$core$$GetOption(options, 'hour12', 'boolean'/*, undefined, undefined*/);

        // 32. If dateTimeFormat has an internal property [[hour]], then
        if (internal['[[hour]]']) {
            // a. If hr12 is undefined, then let hr12 be the result of calling the [[Get]]
            //    internal method of dataLocaleData with argument "hour12".
            hr12 = hr12 === undefined ? dataLocaleData.hour12 : hr12;

            // b. Set the [[hour12]] internal property of dateTimeFormat to hr12.
            internal['[[hour12]]'] = hr12;

            // c. If hr12 is true, then
            if (hr12 === true) {
                var
                // i. Let hourNo0 be the result of calling the [[Get]] internal method of
                //    dataLocaleData with argument "hourNo0".
                    hourNo0 = dataLocaleData.hourNo0;

                // ii. Set the [[hourNo0]] internal property of dateTimeFormat to hourNo0.
                internal['[[hourNo0]]'] = hourNo0;

                // iii. Let pattern be the result of calling the [[Get]] internal method of
                //      bestFormat with argument "pattern12".
                pattern = bestFormat.pattern12;
            }

            // d. Else
            else
                // i. Let pattern be the result of calling the [[Get]] internal method of
                //    bestFormat with argument "pattern".
                pattern = bestFormat.pattern;
        }

        // 33. Else
        else
            // a. Let pattern be the result of calling the [[Get]] internal method of
            //    bestFormat with argument "pattern".
            pattern = bestFormat.pattern;

        // 34. Set the [[pattern]] internal property of dateTimeFormat to pattern.
        internal['[[pattern]]'] = pattern;

        // 35. Set the [[boundFormat]] internal property of dateTimeFormat to undefined.
        internal['[[boundFormat]]'] = undefined;

        // 36. Set the [[initializedDateTimeFormat]] internal property of dateTimeFormat to
        //     true.
        internal['[[initializedDateTimeFormat]]'] = true;

        // In ES3, we need to pre-bind the format() function
        if ($$core$$es3)
            dateTimeFormat.format = $$core$$GetFormatDateTime.call(dateTimeFormat);

        // Restore the RegExp properties
        regexpState.exp.test(regexpState.input);

        // Return the newly initialised object
        return dateTimeFormat;
    }
1331358
function formatAddress(address) {
  const result = address
  if (result) {
    result.formatted =
      `${result.street_address}\n${result.postal_code} ${result.locality}\n${result.country}`
    return result
  }
  return null
}