All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.build.esm.utils.parameterize.js Maven / Gradle / Ivy

There is a newer version: 8.39.0
Show newest version
/**
 * Tagged template function which returns paramaterized representation of the message
 * For example: parameterize`This is a log statement with ${x} and ${y} params`, would return:
 * "__sentry_template_string__": 'This is a log statement with %s and %s params',
 * "__sentry_template_values__": ['first', 'second']
 * @param strings An array of string values splitted between expressions
 * @param values Expressions extracted from template string
 * @returns String with template information in __sentry_template_string__ and __sentry_template_values__ properties
 */
function parameterize(strings, ...values) {
  const formatted = new String(String.raw(strings, ...values)) ;
  formatted.__sentry_template_string__ = strings.join('\x00').replace(/%/g, '%%').replace(/\0/g, '%s');
  formatted.__sentry_template_values__ = values;
  return formatted;
}

export { parameterize };
//# sourceMappingURL=parameterize.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy