MCPcopy
hub / github.com/webpack/webpack / _es5Concatenation

Method _es5Concatenation

lib/RuntimeTemplate.js:346–356  ·  view source on GitHub ↗

* Returns result expression. * @param {(string | { expr: string })[]} args args (len >= 2) * @returns {string} result expression * @private

(args)

Source from the content-addressed store, hash-verified

344 * @private
345 */
346 _es5Concatenation(args) {
347 const str = args
348 .map((arg) => (typeof arg === "string" ? JSON.stringify(arg) : arg.expr))
349 .join(" + ");
350
351 // when the first two args are expression, we need to prepend "" + to force string
352 // concatenation instead of number addition.
353 return typeof args[0] !== "string" && typeof args[1] !== "string"
354 ? `"" + ${str}`
355 : str;
356 }
357
358 /**
359 * Expression function.

Callers 1

concatenationMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected