(meta: string = '')
| 315 | * @returns Object with id, meaning and description fields |
| 316 | */ |
| 317 | export function parseI18nMeta(meta: string = ''): I18nMeta { |
| 318 | let customId: string | undefined; |
| 319 | let meaning: string | undefined; |
| 320 | let description: string | undefined; |
| 321 | |
| 322 | meta = meta.trim(); |
| 323 | if (meta) { |
| 324 | const idIndex = meta.indexOf(I18N_ID_SEPARATOR); |
| 325 | const descIndex = meta.indexOf(I18N_MEANING_SEPARATOR); |
| 326 | let meaningAndDesc: string; |
| 327 | [meaningAndDesc, customId] = |
| 328 | idIndex > -1 ? [meta.slice(0, idIndex), meta.slice(idIndex + 2)] : [meta, '']; |
| 329 | [meaning, description] = |
| 330 | descIndex > -1 |
| 331 | ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] |
| 332 | : ['', meaningAndDesc]; |
| 333 | } |
| 334 | |
| 335 | return {customId, meaning, description}; |
| 336 | } |
| 337 | |
| 338 | // Converts i18n meta information for a message (id, description, meaning) |
| 339 | // to a JsDoc statement formatted as expected by the Closure compiler. |
no test coverage detected
searching dependent graphs…