MCPcopy Create free account
hub / github.com/angular/angular / _parseMessageMeta

Function _parseMessageMeta

packages/compiler/src/i18n/extractor_merger.ts:637–650  ·  view source on GitHub ↗
(i18n?: string)

Source from the content-addressed store, hash-verified

635}
636
637function _parseMessageMeta(i18n?: string): {meaning: string; description: string; id: string} {
638 if (!i18n) return {meaning: '', description: '', id: ''};
639
640 const idIndex = i18n.indexOf(ID_SEPARATOR);
641 const descIndex = i18n.indexOf(MEANING_SEPARATOR);
642 const [meaningAndDesc, id] =
643 idIndex > -1 ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, ''];
644 const [meaning, description] =
645 descIndex > -1
646 ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)]
647 : ['', meaningAndDesc];
648
649 return {meaning, description, id: id.trim()};
650}
651
652function isTextNode(ast: html.Node[]): ast is [html.Text] {
653 return ast.length === 1 && ast[0] instanceof html.Text;

Callers 2

_addMessageMethod · 0.85
_translateAttributesMethod · 0.85

Calls 2

indexOfMethod · 0.80
sliceMethod · 0.65

Tested by

no test coverage detected