* Returns converted identity. * @param {string | string[]} s string to convert to identity * @returns {string} converted identity
(s)
| 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. |
no test coverage detected