* @param {Map } messages * @returns {string}
(messages)
| 134 | * @returns {string} |
| 135 | */ |
| 136 | function stringifyLocale(messages) { |
| 137 | /** @type {string[]} */ |
| 138 | const lines = []; |
| 139 | messages.forEach((message, id) => { |
| 140 | lines.push(`@${id}`); |
| 141 | const hasDoubleNewLines = /\n\n/.test(message); |
| 142 | message.split('\n') |
| 143 | .filter((line) => line.trim()) |
| 144 | .forEach((line, index, filtered) => { |
| 145 | lines.push(line); |
| 146 | if (hasDoubleNewLines && index < filtered.length - 1) { |
| 147 | lines.push(''); |
| 148 | } |
| 149 | }); |
| 150 | lines.push(''); |
| 151 | }); |
| 152 | return lines.join('\n'); |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * @returns {Promise<string[]>} |
no outgoing calls
no test coverage detected