(meta: string = '')
| 299 | * @returns Object with id, meaning and description fields |
| 300 | */ |
| 301 | export function parseI18nMeta(meta: string = ''): I18nMeta { |
| 302 | let customId: string | undefined; |
| 303 | let meaning: string | undefined; |
| 304 | let description: string | undefined; |
| 305 | |
| 306 | meta = meta.trim(); |
| 307 | if (meta) { |
| 308 | const idIndex = meta.indexOf(I18N_ID_SEPARATOR); |
| 309 | const descIndex = meta.indexOf(I18N_MEANING_SEPARATOR); |
| 310 | let meaningAndDesc: string; |
| 311 | [meaningAndDesc, customId] = |
| 312 | idIndex > -1 ? [meta.slice(0, idIndex), meta.slice(idIndex + 2)] : [meta, '']; |
| 313 | [meaning, description] = |
| 314 | descIndex > -1 |
| 315 | ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] |
| 316 | : ['', meaningAndDesc]; |
| 317 | } |
| 318 | |
| 319 | return {customId, meaning, description}; |
| 320 | } |
| 321 | |
| 322 | // Converts i18n meta information for a message (id, description, meaning) |
| 323 | // to a JsDoc statement formatted as expected by the Closure compiler. |
no test coverage detected