MCPcopy
hub / github.com/webpack/webpack / indent

Method indent

lib/Template.js:236–244  ·  view source on GitHub ↗

* Returns converted identity. * @param {string | string[]} s string to convert to identity * @returns {string} converted identity

(s)

Source from the content-addressed store, hash-verified

234 * @returns {string} converted identity
235 */
236 static indent(s) {
237 if (Array.isArray(s)) {
238 return s.map(Template.indent).join("\n");
239 }
240 const str = s.trimEnd();
241 if (!str) return "";
242 const ind = str[0] === "\n" ? "" : "\t";
243 return ind + str.replace(/\n([^\n])/g, "\n\t$1");
244 }
245
246 /**
247 * Returns new prefix string.

Callers 15

getAsyncWeakSourceMethod · 0.80
getEagerSourceMethod · 0.80
getLazyOnceSourceMethod · 0.80
getLazySourceMethod · 0.80
basicFunctionMethod · 0.80
methodMethod · 0.80
forEachMethod · 0.80
wrapInConditionFunction · 0.80
renderMethod · 0.80
generateMethod · 0.80
codeGenerationMethod · 0.80
codeGenerationMethod · 0.80

Calls 2

isArrayMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected