MCPcopy Index your code
hub / github.com/angular/angular / parseMetadata

Function parseMetadata

packages/localize/src/utils/src/messages.ts:247–264  ·  view source on GitHub ↗
(cooked: string, raw: string)

Source from the content-addressed store, hash-verified

245 * @returns A object containing any metadata that was parsed from the message part.
246 */
247export function parseMetadata(cooked: string, raw: string): MessageMetadata {
248 const {text: messageString, block} = splitBlock(cooked, raw);
249 if (block === undefined) {
250 return {text: messageString};
251 } else {
252 const [meaningDescAndId, ...legacyIds] = block.split(LEGACY_ID_INDICATOR);
253 const [meaningAndDesc, customId] = meaningDescAndId.split(ID_SEPARATOR, 2);
254 let [meaning, description]: (string | undefined)[] = meaningAndDesc.split(MEANING_SEPARATOR, 2);
255 if (description === undefined) {
256 description = meaning;
257 meaning = undefined;
258 }
259 if (description === '') {
260 description = undefined;
261 }
262 return {text: messageString, meaning, description, customId, legacyIds};
263 }
264}
265
266/**
267 * Parse the given message part (`cooked` + `raw`) to extract any placeholder metadata from the

Callers 2

messages_spec.tsFile · 0.85
parseMessageFunction · 0.85

Calls 1

splitBlockFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…